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.
Note: this solution contains undefined behavior!
The signedness of char is impl-defined, while overflow of a signed integer is undefined.
The lexer and parser parts are very elegant!
Why? I see on cppreference that it has been in standard since C++11. Since the solution has already tested if the result is empty, I think there won't be any undefined behavior here.
No I can't.
I tried to use operator() and operator int in a class to simulate a function but it just does not compile. Wonder if someone compiles.
This solution has a taste of functional programming
My solution is bad because there is unnecessary string creation. It's okay to just modify the strings in arr themselves since std::string is mutable, unlike strings in C# and many other languages.
I met with the same problem in Rust. I thought there would be only SPACES before and after the string so I used .trim() to remove them, which worked quite well in C#, but I still couldn't pass the tests. I saw the solution ranking No.1 used filter map to eliminate the invalid input, which I guess shouldn't be necessary, so I wonder what the test cases are.
Very concise solution!
this solution works but does not do what it is expected to do, so I re-submitted it.
This solution is rather structurized and I love it!
Love this!