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

 

zbaharav@kehillah.org twelvedaysofap > isSteep
prev  |  next  |  chance

An array is called steep if it has an element that is greater than twice the sum of all the elements to its left, and greater than 3 times the sum of the elements to its right. For example, [2,4,16,3,2] is steep, because 16 is larger than 2*(2+4) and also 16 is larger than 3*(3+2). Given an input array 'a', return whether it is steep or not. Note 1: If there are no elements to the right(or left), their sum is considered zero. Note 2: Don't worry about efficency. Note 3: Try to get it working on first try!


isSteep([2, 4, 16, 3, 2]) → true
isSteep([2, 4, 15]) → true
isSteep([3]) → true

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

public boolean isSteep(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