← All problemsSign in

Chessboard Distance

CodeChefRating 690Open on judge ↗

The Chessboard Distance for any two points $(X_1, Y_1)$ and $(X_2, Y_2)$ on a Cartesian plane is defined as $max(|X_1 - X_2|, |Y_1 - Y_2|)$. You are given two points $(X_1, Y_1)$ and $(X_2, Y_2)$. Output their Chessboard Distance. Note that, $|P|$ denotes the absolute value of integer $P$. For example, $|-4| = 4$ and $|7| = 7$. ### Input - First line will contain $T$, the number of test cases

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