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.
I was very happy with a lambda until I saw this one. I don't know if it is any good, but it's clever.
Even I, as a rookie, can appreciate this one!
that's so fucking clever, you ever needed to implement anything
Why isn't it best practice? Because of efficiency?
If it is the readability, it is one of the most readable solutions, certainly more readable than regex.
This comment is hidden because it contains spoiler information about the solution
can you explain that?
This code does not change the order.
list.remove(element) never changes the order of the remaining elements, this is guaranteed.
This removes the first occurrences of the element, not the last occurrences.
The description of the kata does not mention the requirement of deleting the last occurrences.
This is indeed a kata issue.
Don't be always quick to mark issues as resolved.
The asker is maybe still confused and that did not help. Because the soltion provided returns a subsequence of the original sequence. So your response "without changing order" does not address the issue.
That is extremely confusing. No one would understand it that way.
With this type of algorithm, even if you would convert it to a recursive one, you would never run out of stack; you would rather run out of memory because of the gigantic numbers before even reaching depth 50 of recursion. Because the recursion depth in this case is log2(n).
To answer: "why does the second sequence you gave not fit the description of the kata?"
The sequence consists of repeatedly performing the given operation on the result of the previous operation, whereas you are performing some kind of string slicing with
i
on the same, initial strings
.e.g., using the Description example:
I actually solved the test cases before posting this question. So I am not asking about how to solve the prolem. My question simply is: "why does the second sequence you gave not fit the description of the kata?" but not "how do I write a function to get like that sequence?"
In other words, I am asking why does the first sequence you gave fit the description, forget about the code.
I put a question instead of an issue, out of respect, in hope to get an answer. But the question was not answered, and was marked resolved. At this point, I lost every hope to question the descritpion and get a fruitful result. Never mind.
This comment is hidden because it contains spoiler information about the solution
What does "idiomatic" mean? And why is it a good thing?
Loading more items...