Hostel Visit output doubt

i m not able to understand why third output is 98 rather than 128

At the third output:
Hostel Built are

  1. Coordinate : 10 ,10 Distance :200
  2. Coordinate : 9 ,9 Distance :162
  3. Coordinate : -8 -8 , Distance : 128
  4. Coordinate : 7 7 Distance : 98
  5. Coordinate : 6 ,6 Distance :72
  6. Coordinate : 5, 5 Distance :50
    So,
    you need to print the kth nearest(smallest) distance
    Here k=3
    so third smallest distance = 98
    As 50<72<98<128<168<200
    Hit like if u get it :slight_smile:
1 Like