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

 

srp4379@lausd.net ap1 > isMountain
prev  |  next  |  chance

Mountain, Part IV: public boolean isMountain(int[] nums). Returns true if the values in the array are ordered as a "mountain"; otherwise returns false. For there to be a mountain, all 3 of the following conditions must hold: (1) There must be a peak. (2) The elements to the left of the peak must appear in increasing order. (3) The elements to the right of the peak must appear in decreasing order. Use the 3 methods that your already wrote: isDecreasing(), isIncreasing(), and getPeakIndex().


isMountain([1, 2, 3, 2, 1]) → true
isMountain([1, 2, 1, 2, 1]) → false
isMountain([1, 2, 3, 1, 5]) → false

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

public boolean isMountain(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: 350

Copyright Nick Parlante 2017 - privacy