Ad
  • Custom User Avatar

    Sorry, I dont get you, I only loop the list and I have my own position reference, you can see all my output are right ....

  • Custom User Avatar

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

  • Custom User Avatar

    those are my results, it failed cause it expect something else

    {'pos': [1, 5, 8, 12, 15, 18], 'peaks': [18, 20, 13, 11, 14, 17]}
    {'pos': [2, 7, 9, 12, 14, 16], 'peaks': [8, 13, 12, 15, 13, 12]}
    {'pos': [4, 6, 9, 12, 15, 18, 20, 22, 26, 28], 'peaks': [18, 8, 12, 5, 19, 12, 7, 18, 15, 20]}
    

    in the description check the ouutput says should equal ....

    I can post my answer code in case you want to verify I'm not altering the input ;-)

  • Custom User Avatar

    No, I'm looping the array as it is. I think it has to do with the negative values, always failed when they are negatives values involved

  • Custom User Avatar

    I got invalid test for the following case:
    pick_peaks([7, 18, 16, 18, 18, 20, -4, 11, 13, 4, 8, 10, 11, 2, -3, 14, 4, 8, 17, 7, 0, 8, 10]
    my answer: {'pos': [1, 5, 8, 12, 15, 18], 'peaks': [18, 20, 13, 11, 14, 17]}
    the program expected: {'pos': [3, 6, 10, 13, 16], 'peaks': [20, 13, 11, 14, 17]}
    regarding the description first peak is in the pos 1 (number 18), dont understand why I'm getting wrong answer

    Y try more attempts same errors:

    Testing for [16, -4, 8, 6, 0, 0, 10, 13, 1, 12, 0, -4, 15, 11, 13, 10, 12, 12, -1, 19]
    {'pos': [2, 7, 9, 12, 14, 16], 'peaks': [8, 13, 12, 15, 13, 12]}
    should equal
    {'pos': [5, 7, 10, 12, 14], 'peaks': [13, 12, 15, 13, 12]}

    Testing for [8, 6, 6, 7, 18, -3, 8, 1, 11, 12, 2, -1, 5, -1, 11, 19, 13, 4, 12, -3, 7, 4, 18, 18, 12, 2, 15, 8, 20, 8]
    {'pos': [4, 6, 9, 12, 15, 18, 20, 22, 26, 28], 'peaks': [18, 8, 12, 5, 19, 12, 7, 18, 15, 20]}
    should equal
    {'pos': [2, 4, 7, 10, 13, 16, 18, 20, 24, 26], 'peaks': [18, 8, 12, 5, 19, 12, 7, 18, 15, 20]}

    Can someone please clarify, thanks

  • Custom User Avatar

    As I said that is a valid PHP code ... ;-)

  • Custom User Avatar

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