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
4mo

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!
Select
Add answer anonymously...

Intuit Software Developer interview questions & answers

A Software Developer was asked 9mo agoQ. What are your thoughts about Intuit?
A Software Developer was asked 11mo agoQ. Given an integer, convert it to a roman numeral.
A Software Developer was asked 11mo agoQ. Why were those particular technologies used in the application you developed?

Popular interview questions of Software Developer

A Software Developer was asked 9mo agoQ1. What are your thoughts about Intuit?
A Software Developer was asked 11mo agoQ2. Given an integer, convert it to a roman numeral.
A Software Developer was asked 11mo agoQ3. Why were those particular technologies used in the application you developed?
Intuit Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits