Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Created June 23, 2022 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuongmep/b8d4c2dea4565ec377f81dcdf9b910bb to your computer and use it in GitHub Desktop.
Save chuongmep/b8d4c2dea4565ec377f81dcdf9b910bb to your computer and use it in GitHub Desktop.
sys.setrecursionlimit(100000)
def is_symmetric(s,i,j):
if i>=j:
return True
if s[i]!=s[j]:
return False
return is_symmetric(s,i+1,j-1)
n = int(input())
s = input()
print("YES" if is_symmetric(s,0,n-1) else "NO")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment