From 3d2b01e7d4d14dd330a0e9b791e88f4883568c6b Mon Sep 17 00:00:00 2001 From: Smarth Date: Fri, 5 Jun 2026 17:43:46 +0530 Subject: [PATCH] Reduce space complexity from O(n) to O(1) --- Check Palindrome Without Built-in Functions | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Check Palindrome Without Built-in Functions b/Check Palindrome Without Built-in Functions index 5c4543b..6c19d35 100644 --- a/Check Palindrome Without Built-in Functions +++ b/Check Palindrome Without Built-in Functions @@ -1,7 +1,12 @@ -s = input().strip() -rev = "" - -for ch in s: - rev = ch + rev - -print("Palindrome" if s == rev else "Not Palindrome") +print("Enter a string") +s=input() +l=0 +r=len(s)-1 +while l