Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
How the sum of the Second Biggest and Second Lowest of
[7]
can give 7??Input validation just distracts from the task.
"Do one thing, and do it well."
Unless the task is writing a parser or similar, don't do input validation.
"Edge cases" are underspecified and are not so much edge cases as undefined in the context of the essential problem.
Just specify the input array will always have at least 4, possibly 3 ( but specify how to handle this case ), numerical values.
Also, specify by spec, not by example. Everything in that code block should be skippable as examples ( because that's what they look like ), and examples should clarify, not specify.
In the initial code, you propose returning the input unchanged. But the return value should be a number, not an array. Propose returning
0
, orarr[0]
, orNaN
for all I care. But use the correct datatype. ( Or justreturn;
, or nothing at all. )the user can modify the input
I can be wrong, but it seems like this never happens?..