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.
Probably not important for katas, because they are always in english.
But this will panic for multiple valid UTF8 chars that are more than 1 byte long. Like ñ or Б.
Well, how would you make it better?
That should be cheating, lol.
then cry about it
if the input is an empty string
[Debug] attempt to subtract with overflow[Release] byte index 1 is out of bounds ofif it's a single character string:
begin <= end (1 <= 0) when slicingmeh
ah yes, bool switch
I should have used
ninstead of_, but I'm just a bit baffled by how to handle all of Rust's explicit type conversions in general, while keeping the code concise! Need a lot of practice here!Also, consider using
.into()as it allows you to change the returning type to&strif you need it later without altering the body of the function.How did i miss this for gods sake
look like chatgpt's solution
That's genius!
AHAHAHA, nice
AFAIK, it's because i64 implements the trait Ord, which contains those methods.
I did the same, but what if
n = 2_147_483_647?Loading more items...