i m not able to understand why third output is 98 rather than 128
Hostel Visit output doubt
At the third output:
Hostel Built are
- Coordinate : 10 ,10 Distance :200
- Coordinate : 9 ,9 Distance :162
- Coordinate : -8 -8 , Distance : 128
- Coordinate : 7 7 Distance : 98
- Coordinate : 6 ,6 Distance :72
- 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
1 Like