6 kyu
Onion array
215 of 549aweleshetu
Description:
An onion array is an array that satisfies the following condition for all values of j
and k
:
If all of the following are true
:
j >= 0
k >= 0
j + k = array.length - 1
j != k
then:
a[j] + a[k] <= 10
Examples:
[1, 2, 19, 4, 5] => true (as 1+5 <= 10 and 2+4 <= 10)
[1, 2, 19, 4, 10] => false (as 1+10 > 10)
Write a function named isOnionArray
/IsOnionArray
/is_onion_array()
that returns true
if its argument is an onion array and returns false
if it is not.
Fundamentals
Similar Kata:
Stats:
Created | Sep 8, 2017 |
Published | Sep 8, 2017 |
Warriors Trained | 967 |
Total Skips | 26 |
Total Code Submissions | 3149 |
Total Times Completed | 549 |
JavaScript Completions | 215 |
C# Completions | 83 |
PHP Completions | 83 |
Python Completions | 201 |
Total Stars | 14 |
% of votes with a positive feedback rating | 88% of 178 |
Total "Very Satisfied" Votes | 144 |
Total "Somewhat Satisfied" Votes | 25 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 13 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |