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

7 Solutions

5 Solvers

Last Solution submitted on Feb 20, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers5

Suggested Problems

More from this Author9

Problem Tags

Community Treasure Hunt

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

Start Hunting!