Hello everyone! I'm a newbie and trying to do some coding exercise. I wrote the following python code and tested it locally without any issue. Could some help me to understand why it doesn't work in the OJ? Thanks for looking at my dumb code!
class Solution: def findPeakElement(self,num): if len(num)==1: print 0 elif num>num: print 0 elif num[-1]>num[-2]: print len(num)-1 else: for i in xrange(1,len(num)-1): if num[i]>num[i-1] and num[i]>num[i+1]: print i break else: continue
It says my answer is wrong:
Input: [-2147483648] Output: null Expected: 0