about | help | code help+videos | done | prefs |
isSteep
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy