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.
Thank you very much. finally solved the cata
Hi @multi - I'm new to C++ so perhaps not the best person to answer in detail, but I was able to solve the kata and then debug your code in the editor a bit.
I found that the error you get is occuring when the input is an empty vector - I fixed this error above by having a check for
if (v.size() == 0) { ... return an empty PeakData struct... }
at the top of your code. It seems afterwards there are still some edge cases on which your code fails but at least it's no longer UB.Please though, in future, use the Codewars markdown if you want to have messages with lots of code - especially more "complicated" languages - as other people are more likely to help you if they can easily read the code.
Also, please consider using the Question tag first before raising an Issue, as the latter tag is reserved for serious problems with the kata itself. Happy coding!
This comment is hidden because it contains spoiler information about the solution
You used Date, as I understand =)
The task said that you should take 365 days as year.
But the Date takes leap year into account.
5 tests of mine return undefined :/
Your year value is exact, with the year being 365.2425 days long. As said above, use 365 days for the year.
Good challenge
No, that's a problem with your code, all those tests are more than 1 year, check that.
interesting challenge.. took me more time in formatting though ...
107 tests have passed, 6 test Failed.
Expected: '4 years, 68 days, 3 hours and 4 minutes', instead got: '4 years, 67 days, 3 hours, 47 minutes and 12 seconds'
Expected: '6 years, 192 days, 13 hours, 3 minutes and 54 seconds', instead got: '6 years, 191 days, 2 hours, 8 minutes and 42 seconds'
Expected: '8 years, 12 days, 13 hours, 41 minutes and 1 second', instead got: '8 years, 10 days, 15 hours, 7 minutes and 25 seconds'
Expected: '7 years, 246 days, 15 hours, 32 minutes and 54 seconds', instead got: '7 years, 244 days, 22 hours, 48 minutes and 30 seconds'
Expected: '3 years, 85 days, 1 hour, 9 minutes and 26 seconds', instead got: '3 years, 84 days, 7 hours, 41 minutes and 50 seconds'
Expected: '1 year, 19 days, 18 hours, 19 minutes and 46 seconds', instead got: '1 year, 19 days, 12 hours, 30 minutes and 34 seconds'
Something must be wrong in this tests... or i Can't see why they are fail when other 107 have passed...
Language is JS
I don't understand how to count more than 250 wagons in 16s?
Thx bro, now my solution complete)
the test uses a created function to do the calculation
all u need to do is print the value entered in function
How can I print them?
I need to add some command to my program? wich one? tell me please.
Loading more items...