← All problemsSign in

Ant in a Box

Problem description. An ant lives in a cuboidal room whose edges are parallel to the axes and one of the corners is on the origin. The corner diagonally opposite to the corner on the origin is located on the point (X, Y, Z). You can verify that each triplet of (X, Y, Z) uniquely identifies a cuboid. The ant wishes to travel from the origin to the corner on (X, Y, Z). Can you help him find the sho

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