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.
There’s absolutely no redundancy here—arrays are mutable by nature, and returning the array from arguments (in cases where N >= arr.length) can lead to unexpected behavior down the line. This practice is known as "defensive copying." If you make it a habit to run a red light just because there are no cars in sight, one day you’ll run it when there is a car. The same logic applies to code. Personally, I see no difference between writing production-level code and solving problems on Codewars—the rules are there for a reason, and they apply everywhere.
Since arrays are not immutable it would be bad if a function has different behaviour depending on the inputs.
This comment is hidden because it contains spoiler information about the solution
For what reason was static removed? How does that help?
This comment is hidden because it contains spoiler information about the solution