Created
June 23, 2022 07:11
-
-
Save chuongmep/b8d4c2dea4565ec377f81dcdf9b910bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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