id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

srp4379@lausd.net mountain > getPeakIndex
prev  |  next  |  chance

Mountain, Part III: Given an array of ints (nums) public int getPeakIndex(int[] arrayp) ---- Returns the index of the first peak (local maximum) in the array, if it exists; otherwise -1.


getPeakIndex([11, 22, 33, 22, 11]) → 2
getPeakIndex([11, 22, 11, 22, 11]) → 1
getPeakIndex([11, 22, 33, 55, 77]) → -1

...Save, Compile, Run (ctrl-enter)

public int getPeakIndex(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 325

Copyright Nick Parlante 2017 - privacy