def findPeak(self, A):
        """
        Binary search
        Microsoft Interview, Oct 2014

        To reduce the complexity of dealing the edge cases:
        * add two anti-peak dummies on the both ends

        :param A: An integers list. A[0] and A[-1] are dummies.
        :return: return any of peek positions.
        """
        n = len(A)
        l = 0
        h = n
        while l < h:
            m = (l+h)/2
            if A[1-m] < A[m] > A[m+1]:
                return m
            elif A[m+1] > A[m]:
                l = m+1
            else:
                h = m

        raise Exception  # will not raise if there are DUMMIES at the both ends.
dataset/ETHPy150Open algorhythms/LintCode/Find Peak Element.py/Solution.findPeak/swapped operands of `-`