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 didn't remove it, it wasn't part of the template when I did this kata.
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
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
I don't see how the string is being passed by reference, as you need to specify by reference in the function parameters, and would change how we access the data within the string. But regex_replace creates an empty result string, and then populates and returns it based on the regex rules against the original string. It is not modifying the original string.
This is the several things I was trying to think of that were just escaping me with regard to shorthands I knew I could use.
This is the solution I had in my brain, but didn't get onto the page. I knew it was in there somewhere.
I'm surprised how many solutions use .replace when it's not supposed to be allowed, though.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Very often, clever and simple to read/understand code may not be the most optimized. Though, it is strange how long it took to run the benchmark which is similarly blackboxed to the final tests here, but the final test/submission took ~1-2s here.
My attempt here is to have creative solutions to problems, not necessarily focus on micro-optimization. It is interesting how slow it seems to be when benchmarked, though, moreso when compared against the tests run here.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Given the initial test asserts the inverse result, I'm not convinced that the other tests are accurate, either. (Shell script)
Are the sample tests meant to not have a single one testing the decorate function we are to define?
The flaw is in the kata writer's logic. They are looking at it as being adjacent after adjacent pairs of directions are removed. In NWSE, they never become adjacent, so cannot be removed. However, it does contradict the intent and meaning behind simplifying the directions provided to the wanderer. It doesn't matter to the supplied solution that it's a circle returning to square one.
NEWSWW => NSWW => WW. There is a way it makes sense, as only when two opposite directions become adjacent can you be sure they can be reduced. There are no distances included in this, so theoretically, NWSE may return you to a geographically different location than where you started, as units of movement may not be equal. Pure conjecture on my part, but makes it fit. Whereas when you go NEWS, you are literally going backwards and folding your movements back on themselves.
Loading more items...