My Simple JavaScript solution


  • 0
    S
    var findPeakElement = function(nums) {
        for(var i=0;i<nums.length-1;i++){
    	if(nums[i]>nums[i+1]) return i;
        }
        return i;
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.