funcdef isPalindrome = func (str: string) -> bool { if len(str) == 0 { return true; } vardef charList = str_to_list(str); vardef left = 0; vardef right = size(charList) - 1; while left < right { if charList[left] != charList[right] { return false; } left = left + 1; right = right - 1; } return true; } vardef result = isPalindrome(str = "top pot"); print result; result = isPalindrome(str = "to pot"); print result;
Console
-
CALL STACK
main