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.
That's clever for sure!
This comment is hidden because it contains spoiler information about the solution
fyi ya can do (1..=n) instead (1..n + 1) to include the end of the range
Thank you for your answer! Do you have any tips for exploring the rust manual?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You could ".rev()" the range, replace the "filter" with "find" and leave out the "last()".
More concise and less iterations since you start from the end of the range instead of evaluating the entire range and then returning the last element.
For Rust are you compiling+running the solution in Release mode and are the compile times also counted against timeouts?
I don't think there ever will be RE in rust::std considering there is a really good crate for that.
It's sad there is no regexp in Rust::std yet...
Thank you for your suggestion
Considering str::replace does one copy and full iteration of the string buffer for EACH call. This may be OK for strings up to a few hundred chars and <10 replace calls, but for anything even approaching real-life scenario a loop is WAY better for performance than multiple str::replace calls.
Then I'd have to have a mutable "counter" variable AND I would have to increment that in the loop body.
This all makes the loop construct a not really desirable solution here.
In this scenario it's much easier and cleaner to have a for-loop with an infinite iterator.
for i in 0i32.. could be replaced with the loop construct.
Considering the integers in the input and output are positive it would be nice of you to use u32 or u64 in Rust instead of i64.
Loading more items...