Following the first problem, now you need to find the shortest path. Given two jugs with capacities A and B, find the minimum number of steps to get exactly T units in either jug. You can Fill, Empty or Pour.
  • input: A, B, T
  • output: n (minimum steps) or -1 if impossible

Solution Stats

15 Solutions

11 Solvers

Last Solution submitted on Apr 10, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers11

Suggested Problems

More from this Author20

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!