public class Solution { public int findPeakElement(int[] nums) { int length=nums.length; if(length==1) return 0; int i=0; for(;inums[i+1]) { break; } } if(nums[length-1]>nums[length-2]) return length-1; return i; }}
本文共 415 字,大约阅读时间需要 1 分钟。
public class Solution { public int findPeakElement(int[] nums) { int length=nums.length; if(length==1) return 0; int i=0; for(;inums[i+1]) { break; } } if(nums[length-1]>nums[length-2]) return length-1; return i; }}
转载于:https://www.cnblogs.com/aguai1992/p/5347570.html