• Custom User Avatar

    No worries! Glad it worked out in the end :+1:

  • Custom User Avatar

    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!

  • Custom User Avatar

    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.

  • Custom User Avatar

    5 tests of mine return undefined :/

  • Custom User Avatar

    Your year value is exact, with the year being 365.2425 days long. As said above, use 365 days for the year.

  • Custom User Avatar
  • Custom User Avatar

    No, that's a problem with your code, all those tests are more than 1 year, check that.

    For the purpose of this Kata, a year is 365 days and a day is 24 hours.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    the test uses a created function to do the calculation
    all u need to do is print the value entered in function

  • Custom User Avatar

    Print them.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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?

  • Custom User Avatar

    I dont know so much about Java but maybe you dont initialize empty string in array?