Chubb interview question

Code for finding peak element