From a0952eb7b2b224559214d1e124f83092b99da5d1 Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Fri, 2 Jul 2021 12:52:55 -0700 Subject: [PATCH] add space complexity --- .../arrays/strings/almost_palindrome_checker.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/data_structures/arrays/strings/almost_palindrome_checker.rb b/data_structures/arrays/strings/almost_palindrome_checker.rb index 75e2212..0115ec3 100644 --- a/data_structures/arrays/strings/almost_palindrome_checker.rb +++ b/data_structures/arrays/strings/almost_palindrome_checker.rb @@ -19,8 +19,15 @@ # 1 <= s.length <= 105 # s consists of lowercase English letters. +# # Approach 1: Two Pointers +# + +# Complexity Analysis: +# # Time Complexity: O(n) +# Space Complexity: O(1) + def almost_palindrome_checker(string) p1 = 0 @@ -57,4 +64,4 @@ puts almost_palindrome_checker('abca') # => true puts almost_palindrome_checker('abc') -# => false \ No newline at end of file +# => false