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.
.
Right, yeah. Well. See if you can make it use integer math and if that works out for you.
js number is a float, but float is able to represent integers.
what introduces non-integers is division, so whenever you do division you have to immediately bring it back into an integer value. continuing to use the result before doing this will likely introduce rounding errors into your results
If printing out the remaining time after hours and minutes, I get:
remaining: 59.99999999999939
So, I suppose the "advice" then is that the entire problem is solvable with integer math and that you should avoid leaning on float in ways where you can introduce rounding errors.
Maybe that's vague for javascript where you're stuck with the float type, but I assume that integer division is still something that can be carried out correctly (?)
..I fixed the obvious bug and now have something that behaves like you originally described. hmm.
I see one thing that's really really wrong and unrelated to rounding.
Maybe you even posted a wrong version of your code? This won't be off by one second, it'll be more wrong than that.
It definitely shouldn't be ambiguous because the inputs are int - the problem is solvable without ever using floats.... except in javascript which in its infinite wisdom doesn't have an integer type. Still, it's possible to do correct integer math in javascript... I think? So something's got to be wrong with what you're doing.
Maybe you're truncating too early or doing something else wrong. You're supposed to floor, that's in the instructions. That's the one thing you know isn't the cause.
This comment is hidden because it contains spoiler information about the solution
the trouble in your solution is that if
find
contains special characters like(
,)
,[
,]
and others, the regexp compiler is going to interpret them as a part of the regexp syntax, because you didnt escape them to signify that they are meant to match a litteral characterThis is why you're seeing a regexp compiler error, i'm guessing the character to find was something
[
and opening brackets need a matching closing bracket in regexp syntaxi hope i helped
Your solution is wrong. Please read and follow the Troubleshooting guide.
Did you change that test? It's repeated verbatim in the Submit tests, so I have a hard time believing you'd fail the Example tests if you pass the Submit tests.
Return a number, not a string.