Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public int peakIndexInMountainArray(int[] A) {
- int ans = -1, number = Integer.MIN_VALUE;
- for(int i = 0; i < A.length; i++) {
- if(A[i] > number) {
- ans = i;
- number = A[i];
- }
- }
- return ans;
- }
- }
Add Comment
Please, Sign In to add comment