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.
so readable! Judging only by this code you seems to be a never nester
Uff, the code is really short but recursion doesn't convince me.
It doesn't compile.
Only one detail: use StringBuilder to concatenate. It's much faster.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
std::stack is a standard container like std::vector or std::list. It is a "stack", so a last-in-first-out (LIFO) container.
For offline use if you want to compile it, you need to #include <stack> header (and #include <string> too).
The Kata tests already have these headers included so I gracefully left those includes. (after years thinking about this, maybe it was a little confusing choice...)
What do you mean by "std::stack op" ? It doesn't compile for me
C++ still needs to be fixed
This solution is not entirely correct. It isn't considering the associativity of operations at all. And it should, because it is explicitly stated in the instructions of the problem that '^' is right-associative while the rest of operations are left-associative. The importance of this distinction can be seen in one of the examples provided, also in the instructions. "1^2^3" should return "123^^", while "1+2+3" should return "12+3+". This solution is not treating adequately the former (returns "12^3^").
It appears there isn't any testcases with two consecutives ^. This should be fixed.
This solution is not entirely correct. It isn't considering the associativity of operations at all. And it should, because it is explicitly stated in the instructions of the problem that '^' is right-associative while the rest of operations are left-associative. The importance of this distinction can be seen in one of the examples provided, also in the instructions. "1^2^3" should return "123^^", while "1+2+3" should return "12+3+". This solution is not treating adequately the former (returns "12^3^").
It appears there isn't any testcases with two consecutives ^. This should be fixed.
There are several issues raised about that.
Much more tests are necessary !! Lots of wrong solutions are being accepted !!
The complexity is terrible. Sorry, even if it is a clear solution, is really bad practice.