classSolution{/** * @paramA: An integers array. * @return: return any of peek positions.*/publicintfindPeak(int[]A){ // write your code hereif(A ==null||A.length<3)return-1;int p =0, r =A.length-1;while(p +1< r){int q = p +(r - p)/2;if(A[q]-A[q -1]>0) p = q;if(A[q +1]-A[q]<0) r = q;else p = q;}returnA[p]>A[r]? p : r;}}