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.
Hi @strangefrond.
The description has been updated :-)
Regarding your suggestion, I think you are missing the point. The ONLY purpose of this Kata was to demonstrate that there are ways to swap 2 variable values without requiring a separate intermediary variable. That's it. End of story. Nobody is saying your suggestion is a bad idea, but enhancing this to be a generic/useful swap function is quite unrelated to the aforementioned intention so I won't be going down that route.
Kind Regards. DM
@strangefrond, I agree with you about satisfaction voting is confusingly labeled :( I either vote "Very" or not vote at all. You can undo the vote by clicking it again, if you want.
@strangefrond, I think I understand you now, thanks for explaining in more detail :)
I think the confusion is caused by JavaScript lacking a data structure like
Tuple
orPair
or pointer (pass by reference) and we are forced to useArray
. It might be helpful to add to the description that the input is always a pair of integers (alwaysary.length == 2
).And second suggestion is to change the function to
swap(array, i, j)
wherearray.length >= 2 and 0 <= i,j < array.length
which swaps elements ati
andj
.Please correct me if I'm misunderstanding you.
One more upvote here to help bring it back up :)... thanks for the Kata!
This comment is hidden because it contains spoiler information about the solution
I thought it was as unambiguous. Clearly from the example I ask for elements [0] and [1] to be swapped.
Meanwhile, satisfaction suddenly plummets to 83% for no good reason. Sigh :-(
@strangefrond,
If that is not enough, can you make a "Suggestion"?
Sorry, I don't understand your second sentence, but this is not an issue. Can you make a "Suggestion" with examples?