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.
10 months ago and nobody fixed it yet? Wow!
The similar (probably a little easier) kata "Sum strings as numbers" says
Python: your solution need to work with huge numbers (about a milion digits), converting to int will not work.
Can't we have a likewise test with huge numbers in this kata as well?
This comment is hidden because it contains spoiler information about the solution
How about the following edge case?
Should this test return an answer, because 101 is within the range, or should it not return an answer because 103 is out of range?
It's not clear for me from the decription and examples.
Yes, it was difficult. How do you C++ people debug such things?
Sure, it was. Yet, if I do similar mistake in other programming languages, I typically get a compiler error.
I think this is a real disadvantage of C++. Code compiles (and for whatever reason even worked), so how should I find out I made a mistake?
This time I was lucky, because Codewars uses a different compiler or whatever. If this were production code, it would have gone unnoticed.
I want to prepare myself for real-world C++ with Codewars. Any additional hints are welcome.
I had an interesting issue and would like to know more details.
All tests passed in my Visual Studio environment, but I didn't pass the acceptance test on CodeWars.
I pulled the test data out of the acceptance test - but they passed in Visual Studio as well.
I then tried to reproduce the issue in an online IDE and the online IDE complained that I did not #include for std::unique().
I #included in Visual Studio and suddenly the tests in Visual Studio had the same results as on CodeWars.
Now I am wondering:
Where did std::unique() in Visual Studio come from when I did not #include ?
What did that version of std::unique() do? Obviously something different.
Where did std::unique in CodeWars come from when I didn't #include ? Can we change that so we get a compiler error?
You gotta love the realism of these Katas. You're given a task and you solve it. All tests pass.
As soon as you publish it, someone comes and says: "Oh, BTW, this should work for numbers up to 4123987691273896765234765. And those 158 tests, that we didn't give to you before, should finish in under 12 seconds."
Wonderful kata.
Typo:
for n as least as large
--> at leastHow many braces am I supposed to put into the equation?
The test "t", "" (true with no operator at all) has unlimited results, depending on the number of braces to be used: (t), ((t)), (((t))), ((((t)))), etc.
Reading the other comments, I also wonder what the operator precedence shall be in order to sort out the duplicates.
The tests do not have namespaces for their types. I have to use
to make the tests work. That's considered bad practice.
Error message if I don't have that in my code:
I have to
otherwise the tests won't work.
It's considered bad practice to do that. I should not need to make assumptions about the tests.
If I don't use that namespace, the error is
I can do a
in my code to fix it, but that's bad practice.
I'm trying the C++ version. The test is fine, but on my attempt, I get
Note that this is in tests.cpp, not main.cpp.
"Focus on efficiency" - CPU or memory?