162. Find Peak Element
class Solution { public int findPeakElement(int[] nums) { for(int i=0;i<nums.length;i++) if((i==0||i>0&&nums[i]>nums[i-1])&&(i==nums.length-1||i<nums.length-1&&nums[i]>nums[i+1])) return i; return -1; } }
class Solution { public int findPeakElement(int[] nums) { for(int i=0;i<nums.length;i++) if((i==0||i>0&&nums[i]>nums[i-1])&&(i==nums.length-1||i<nums.length-1&&nums[i]>nums[i+1])) return i; return -1; } }