It's easy to understand, when you turn the brackets into readable characters. o for opening bracket ( c for closing bracket )
So ()() would be ococ, which is coco backwards and clearly not a palindrome.
())( would be occo, which is a palindrome.
It's easy to understand, when you turn the brackets into readable characters.
o for opening bracket (
c for closing bracket )
So ()() would be ococ, which is coco backwards and clearly not a palindrome.
())( would be occo, which is a palindrome.