← All problemsSign in

Rectangle In Peace RIP

You are given N lines on the axes of a coordinate. The lines are represented by 2 endpoints namely $(x1,y1)$ and $(x2,y2)$. Now your task is to check whether $all$ points combine to form a rectangle of 4 sides. All the lines given are either parallel to the x-axis or y-axis. Remember a valid rectangle is a rectangle with all the lines falling to its 4 sides and there is no gap or blank space in an

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start