Ad
  • Custom User Avatar

    Your problem is below this line:

    //We dont want to outIndex
    
  • Custom User Avatar

    Without the input too, there is no much that we can do to see if there is a problem or not.

  • Default User Avatar

    Nothing broken... Please before posting issues look at the top of the page to see how many people passed the kata (6435 in Java; your language I suppose). If there were errors chances are somebody would have seen that before you:-)

  • Custom User Avatar
  • Default User Avatar

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

  • Custom User Avatar

    Please, don't spoil the kata. Mark your post as having spoiler content next time.

  • Custom User Avatar

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

  • Default User Avatar

    Your problem occurs if the unique value is the last value in the array. If that happens, your function getResult(occurrence, null) is called. In that case, you are creating a List survivor and populating it with every key that occurs in in your keylist 1 time, which will be all of them. Keys naturally appear in HashMaps only once. The test that you are failing, the array is [8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 7.0]. Right before you return your value, survivor is [8.0, 7.0]. I think what you wanted to do was get the key in occurrence where the value is 1, however, you never actually update any key in occurrence to have a value of more than 1 at any time.