Jobs
Interviews

Solve Valid Rectangle from Points using C Language

Solve Valid Rectangle from Points using C to enhance your skills with c coding practice , master coding concepts, and prepare for interviews with practical exercises and detailed solutions.

Valid Rectangle from Points

Difficulty : Medium

Categories :

  • Mathematics

Given a list of points in 2D space, determine if they can form a rectangle when connected. Points are given as [x,y] coordinates, and the sides of the rectangle must be parallel to the x and y axes. The points can be given in any order.

Constraints:

  • points.length = 4
  • points[i].length = 2
  • -10⁴ ≤ points[i][0], points[i][1] ≤ 10⁴
  • All coordinates are integers
  • Points are unique

Examples:

Input: [[1,1],[1,4],[4,1],[4,4]]
Output: true
Explanation: Points form a 3x3 rectangle
Input: [[1,1],[1,3],[2,1],[2,3]]
Output: true
Explanation: Points form a 1x2 rectangle
Input: [[1,1],[2,2],[3,3],[4,4]]
Output: false
Explanation: Points form a line

Coding works best on a laptop or desktop, with a keyboard and a wider editor. You can read the problem here and solve it there.

Problem Solving

Input

What You'll Find Here

Practical Challenges Solve coding problems that strengthen your understanding of C.

Step-by-Step Tutorials Learn how to write efficient and optimized code.

Career-Focused Skills Prepare for technical interviews with targeted exercises.

Choose from the following categories