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

 

zbaharav@kehillah.org 91-review-light > flatHill
prev  |  next  |  chance

Given an array of integers, a flat-hill is a sequence of 4 consecutive elements such that the first element is smaller than the second, the second is equal to the third, and the third is greater than the fourth. Write a function that gets as an input an array of integers, and returns true if it contains a flat hill, and false otherwise.


flatHill([1, 2, 3, 4]) → false
flatHill([1, 2, 3, 3, 2, 1]) → true
flatHill([1, 2, 3, 3, 3, 4]) → false

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

public boolean flatHill(int[] a) { }

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: 100

Copyright Nick Parlante 2017 - privacy