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.
You can store 'ls' in new variable like..
const ts = ls;
This comment is hidden because it contains spoiler information about the solution
My guess is that the main tests have a way of calling back the local variable from the function and reusing it to discourage this approach to the question. Storing the input list in a new variable also seems not to help avoid this. If this is an intentional preventative measure then why is it being used -- what is wrong with trimming values from the list as an approach to solving this kata?
Hi. So I ignored the advice not to modify the input list
ls
and for the main tests it seems that this causes the one test to impact the inputs to the next. If I just make the function print the inputs then I seels
at the start of the function is different to printingls
at the start of the function and then attempting to solve the kata by editingls
later in the function.Can someone explain to me how editing the local variable
ls
within the function can affect the input value ofls
in seperate calls of the function?The kata says this is the mountainous Wild West. Hence it can be assumed that such instructions can't be simplified as they may be navigating around obstacles