Broken Calculator — Solution & Editorial
Reason backwards from B: halve when even, increment when odd; once B ≤ A the rest are decrements (forwards). Forward greedy over-doubles.
Complexity: O(log B)
Watch out: Forward reasoning fails (when to stop doubling?) — the backwards moves are forced.