mirror of
https://github.com/TheAlgorithms/Ruby
synced 2024-12-25 21:58:57 +01:00
add space complexity
This commit is contained in:
parent
b40fe95c43
commit
a0952eb7b2
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
# => false
|
||||
|
|
Loading…
Reference in a new issue