add log(n) solution for peak element