← All problemsSign in

Manhattan Buddies

Consider a rectangle of dimensions $n*m$ on the coordinate plane with it’s vertices being $(0,0)-(n,0)-(n,m)-(0,m)$ Anirudh is a fan of Manhattan distance problems so he coined a new term Manhattan buddies. A pair of points are said to be Manhattan buddies if they have integer coordinates ($x_i$ and $y_i$ are integers) and the Manhattan distance between them is $1$. Manhattan distance between

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