Chef and Close Friends
Chef lives at position $x$ on the $x$ - axis. Chef has $2y$ friends, each living at every integer point in the range: [$x$ − $y$, $x$ + $y$] except the position $x$ itself. Chef wants to visit his friends, but his mother has placed a strict rule: Chef is allowed to travel at most $z$ units away from his home in either direction. This means Chef can only move within the interval [$x$ − $z$, $x$
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.
Sign in to chat with the tutor and save your progress.
Sign in to start