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.
No worries! Glad it worked out in the end
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!
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.
No, that's a problem with your code, all those tests are more than 1 year, check that.
This comment is hidden because it contains spoiler information about the solution
the test uses a created function to do the calculation
all u need to do is print the value entered in function
Print them.
This comment is hidden because it contains spoiler information about the solution
We can't either. Read the Troubleshooting your solution guide, which includes posting your solution with proper markup to make it readable, and mentioning your language. Help us help you!
Closing.
Also, why does that almost last line say "missing return statement"? Might that be a clue?
I dont know so much about Java but maybe you dont initialize empty string in array?