First you have to sort all bones position according to following condition -

  1. If distance of two point is same then there can be two case -

    1.1 - then if the coordinate of two point is same then which have greater index (means which comes later in input) will come forward.

    1.2 if coordinate is not same then which have lesser index will be come forward.

  2. If distance is not same then point which have greater distance will come forward.
    if number of unique distance is greater then or equal to k then answer exist.

After sorting run a loop over sorted data and count how many unique distance you get till now.When this count become equal to k that index is answer.

Statistics

73% Solution Ratio
izNoGoodEarliest, Apr '18
nusuBotFastest, 0.8s
return_noorLightest, 3.3 MB
knowbodyShortest, 1254B
Toph uses cookies. By continuing you agree to our Cookie Policy.