For example,
A correct input would be "05:07:10", but gets passed in as "5:7:10".
You can fix this with the line let audioLength = [hh, mm, ss].map(v => ("0" + v).slice(("0" + v).length - 2)).join(':');, albeit a bit messy. I would recommend padStart instead of that map, but you would have to put in the polyfill yourself.
tag HIGHER-ORDER FUNCTIONS is not appropriate
This comment is hidden because it contains spoiler information about the solution
Approved; then started stumbling on lots of half-solved problems. Fixed those.
Issues should not be closed before having outside confirmation that the problem is actually solved ( or more than reasonable time has passed ).
I have added a polyFill for the used padding function to
Preloaded
.Node 6.x does not have
"".padStart
, so the random submit tests crashed when using anything other than Node 8.x.It still happened. I have fixed the reference solution.
I still can't figure out why it was expecting ":60" sometimes. I'm not perfect, but that code cannot have been either if it was that hard to read.
I have made it even more clear.
Do not put specifications in examples only. Examples should clarify, not specify.
I have floored the input values used in creating the random test so this should not happen anymore. :)
Thanks for spotting this. I have updated my test generator to pad the inputs
Thank you for this suggestion. I have updated the specification and I hope it is more clear
I think you should specify rounding rules in the specifications.
e.g. ("00:00:55", 2) => "00:00:27"? "00:00:28"?
IMHO, it makes more sense to truncate than to round but either way it should be made apparent.
Inputs aren't passed in in the correct format.
For example,
A correct input would be "05:07:10", but gets passed in as "5:7:10".
You can fix this with the line
let audioLength = [hh, mm, ss].map(v => ("0" + v).slice(("0" + v).length - 2)).join(':');
, albeit a bit messy. I would recommendpadStart
instead of thatmap
, but you would have to put in the polyfill yourself.This still happens. In 10,000 random test iterations, 54 of them produce the incorrect solution.
e.g.
Expected: '68:20:60', instead got: '68:21:00'
This comment is hidden because it contains spoiler information about the solution
From a random test:
Expected: '24:40:60', instead got: '24:41:00'
This happens occasionally. I think you have a
floor
in the wrong place somewhere.Oh yes! Thanks for pointing that out
Loading more items...