GlobalFoundries Interview Question

check brackets, first duplicate element, palindrome.