Closest Distance Pair Problem Statement
Given an array containing 'N' points in a 2D plane, determine the minimum distance between the closest pair of points.
Note:
Distance between two points (x1, y1) and (x2, y2) is given by [(x1 - x2) ^ 2] + [(y1 - y2) ^ 2].
Input:
The first line contains a single integer 'N' denoting the number of points.
The next 'N' lines each contain two integers separated by a space, representing the x and y coordinates of the points respectively.
Output:
The output should be the minimum distance between the 'N' points.
Example:
Input:
4
0 0
0 2
2 0
2 2
Output:
4
Constraints:
- 2 <= 'N' <= 105
- -105 <= 'x' <= 105
- -105 <= 'y' <= 105
- Time Limit: 1 sec
Note:
You are not required to print anything; just implement the function.
AnswerBot
1d
The problem involves finding the minimum distance between the closest pair of points in a 2D plane.
Iterate through all pairs of points and calculate the distance between them using the given formula.
K...read more
Help your peers!
Add answer anonymously...
Top Intuit Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Intuit Software Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app