Ad
  • Default User Avatar

    You say to compare Y and Z in each iteration? Z is always greater than Y, so what do you mean by comparing?

  • Default User Avatar

    All tests pass

    Unfortunately no, hence the "Error: execution of an external program failed: '/workspace/tests '".

    Nevertheless all was green because the testing function was wrongly placed.
    It is fixed now and you will be able to see where your function has flaws.
    I see you don't have a great practice of CW so you must know that when you post code, as you did, you have to mark your post as "Spoiler" (Red label. I did it for you). Cheers.

  • Custom User Avatar

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

  • Default User Avatar

    In the instruction is said: Each part of the string is of the form: h|m|s where h, m, s (h for hour, m for minutes, s for seconds) are positive or null integer (represented as strings) with one or two digits. There are no traps in this format.

    Here are strings that I am getting for attemps:
    Log
    01|15|59, 1|47|16, 01|17|20, 1|32|34, 2|17|1702|15|59, 2|47|16, 02|17|20, 2|32|34, 2|17|17, 2|22|00, 2|31|4102|15|59, 2|47|16, 02|17|20, 2|32|34, 2|32|34, 2|17|17

    Can anyone says what are 2|17|1702|15|59, and 2|31|4102|15|59,? These are not in order and causing wrong results.

  • Default User Avatar

    Thanks!

  • Custom User Avatar

    Basically there is an element after it (there can be elements equal than after it too, those are part of the plateau) that's less than it, and there was another less than it before.

  • Default User Avatar

    How can you check if an element is peak-plateau? any role ?
    Cheers

  • Custom User Avatar

    You have to somehow store a peak candidate until you can say for sure if it was a peak or a peak-plateau or disregard it if it wasn't.

  • Default User Avatar

    it is correct, I meant in the follwing vector <1, 2, 2, 2, 1> how should I find the peak-plateau?

    thanks

  • Custom User Avatar

    There's no peak there.

    Also, beware of plateaus !!! [1, 2, 2, 2, 1] has a peak while [1, 2, 2, 2, 3] and [1, 2, 2, 2, 2] do not.

  • Default User Avatar

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