6 kyu
Onion array
215 of 549aweleshetu
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I wish the feedback from the error message was clearer, as it's not clear on which exact example the code fails.
I don't get the k+j < length part.. And the description makes it even more confusing if you have a number such as 19 in a an array of length 5 that automatically shouldn't be possible to an onion since 19 will always be bigger than the length?
JS: Node v14 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this
This comment has been hidden.
From the solutions I learn that an empty array is considered an onion array. This souds strange to me. Also arrays with an even number of elements are considered valid onion arrays whilst the tests/examples only show arrays with an odd nunmber of elements.
This comment has been hidden.
Python translation. Please, review and approve.
Can somebody explain me this please: "If all of the following are true: ... j + k = array.length - 1"
why is ([1, 2, 19, 4, 5]) an onion array? In my understanding, 1+5 = 6; but array.length - 1 would be 4?
So
[1, 2, 19, 4, 5].length
is5
, and[1, 2, 19, 4, 5].length - 1
is4
. Remember that indexing starts at zero, so[1, 2, 19, 4, 5][4]
is the fifth element, which equals5
.Does that answer your question?
///
PHP Translation Kumited - please carefully review and approve :D
Approved
The description could be clearer. This is more of a reading task than a programming task. People actually are submitting
O(n²)
solutions. This may be what you want, or not.well, i don't have any performance benchmark. Because i don't see this kata jumping
7kyu
rating :)True.
But do you want it to be a moderately hard reading assignment, or an easy programming one?
(Either one works for me! :)
Yep, really hard to understand what's expected !
; ) )
suggest how it could be more readable ?
May be some examples would help :
ok, cool. I took two of your examples and added it. Hope that helps.
That makes it a lot clearer, without actually spelling out the solution.
j+k=length or j+k+1=length ?
one less than length of array :D