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.
For 2 million characters, the difference will be as follows
Time taken by regex function: 12066 ms
Time taken by set function: 2837 ms
Time taken by erase function: 123 ms
Argh ! I thought i can't add a include file...
I didn't remove it, it wasn't part of the template when I did this kata.
You deleted "const" from function - this is bad.
Fixed the description
it's still O(n^2)
because you have one cicle in another (indexOf is cicle)
If floating point values are supposed to be converted, they should probably be part of the tests. Maybe it's language based, but very odd that it's forcing to int.
This comment is hidden because it contains spoiler information about the solution
This is genius! I took this opportunity to refresh indexOf(searchElement, fromIndex).
This comment is hidden because it contains spoiler information about the solution
I was also trying the same solution but didn't knew we can start indexOf function from any given position
programming is cheating! Pen&paper for life!!
I don't recall anything having a reference to &str in the details of this, but if we want to discuss the details of the task:
Your task is to write a function that takes a string and return a new string with all vowels removed.
It states that you are taking a string, and returning a new string. So modifying the existing string and returning it is not the same as returning a new string, as described in the assignment. If there is a by reference involved in the solution's template, that may be an update to the kata from the time this, and many other solutions were written. But in any event, the details of the task tell you to return a new string, not the one that was sent to the function.
/shrug
If the take in parameter is marked '&str' (as it is in the assignment. '&' is removed in this solution) you are supposed to use the original string directly through reference. This reduces memory usage and increases speed =)
Anyway this is how i see it. Correct if am wrong.
for
loop is cheating.Loading more items...