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.
This comment is hidden because it contains spoiler information about the solution
I tried to solve this in Rust. It's not that hard, but it pigeonholes you so hard into a bad design that exposes internals and has a bad memory layout, all of which I was trying to avoid. After a lot of trying to work around the bad design, I passed the local tests, but I was unable to pass the real tests due to the repeated use of design implementation internals that should not have been relied on. Even beyond that, pretty much everything you're being told is a requirement is non-idiomatic Rust:
to_vec
instead of implementing theFrom
/Into
trait, custommap
andfilter
instead of implementing theIntoIter
andIterable
traits, customfrom_iter
instead of implementing theFromIterator
trait.If all of that ever gets fixed, I'd love to try this again. Peace ✌🏻
This comment is hidden because it contains spoiler information about the solution
I can't wait for the
std::iter::Iterator#array_chunks<const N: usize>
feature to be stable! Then you won't even needitertools
to do this.😭 why would you poorly obfuscate a function that reverses strings
This is an abomination...
This isn't even good. You're recreating a huge array every time this is called. And the other option isn't very good either because you'd have a giant array just taking up memory.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
If you're gonna create a variable called count to hold results[i] then you should at least use it (look at the line after
if (count > 0)
).You should check out mine, instead of calling begin() every time I had it use the return statement of insert so you only have to call begin once. Also I never changed n I just assigned it to the vector which I think works better in a way.
Why didn't you just return rev_result instead of returning {rev_result.rbegin(), rev_result.rend()}