Function to check if the characters in the given string forms a Palindrome in O ( 1 ) extra space
def isPalindrome ( str ) : NEW_LINE INDENT firstChar = 0 NEW_LINE lastChar = len ( str ) - 1 NEW_LINE ch = True NEW_LINE for i in range ( len ( str ) ) : NEW_LINE INDENT firstChar = firstPos ( str , firstChar , lastChar ) ; NEW_LINE lastChar = lastPos ( str , lastChar , firstChar ) ; NEW_LINE DEDENT DEDENT