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.
The only change you did, is wrong. Take a look at
n
value, it's wrong too (and maybe there are more errors). In fact, you're setting it as-inf
every time and your loop doesn't even run. You also overwriten
.I have two solutions that worked in C++ and there are 781 C++ completions already, the problem is in your code. Read the instructions again, fix all the errors or start again checking every step.
Not a kata issue, your code is wrong, and I already explained why you see 1 instead of true or 0 instead of false here
Read the description and check this example again:
Do you see what's wrong with your code now?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
That's not a problem, your code is wrong. When you return
true
it'll show a1
and when you returnfalse
it'll show a0
but the comparison with a boolean will work.You can check this returning
true
orfalse
and checking if it passes one of the sample tests. You can read more here: https://www.w3schools.com/cpp/cpp_booleans.aspThis comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
can it be more optimized?