← All problemsSign in

1654. Minimum Jumps to Reach Home

LeetCodeArrayHash TableBreadth-First SearchOpen on judge ↗

A certain bug's home is on the x-axis at position x. Help them get there from position 0. The bug jumps according to the following rules: - It can jump exactly a positions forward (to the right). - It can jump exactly b positions backward (to the left). - It cannot jump backward twice in a row. - It cannot jump to any forbidden positions. The bug may jump forward beyond its home, but it cann

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