Nokia Coding Question – Solved

5 Live
Homework The distance between 2 points (x y1) and (x2 y2) on a 2D plane is defined as But Paul, the math teacher, defined the distance between 2 points (x1, y1) and (x2,y2) on a 2D plane as min(|z1-z2l, [y/1 - val) in his class. As homework, he gave N points to the students and asked Min smallest distance between all possible pairs of points according to his new definition. You are given N points on a 2D plane. Help the students to complete the homework. Calculate the Mh smallest distance according to Paul's new definition of distance. Notes - Assume #based indexing. - All N points are unique. - Mth smallest distance stands for Mth element you get by arranging all possible distances in increasing order. Function description Complete the function homework. This function takes the following 3 parameters and returns the required answer, an integer, the Mth smallest distance: - N: Represents an integer denoting total points - Points: Represents an array of pairs representing points on a 2D plane - M. Represents the required smallest distance

Asked in: Nokia

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |