GlobalFoundries interview question

check brackets, first duplicate element, palindrome.