Tap here to switch tabs
Problem
Submissions

Problem: Broken Calculator

med
30 min
Try to solve the Broken Calculator problem.

Statement

There is a broken calculator displaying the integer startValue. In one operation, you can perform one of the following actions:

  • Multiply the current number by 22.

  • Subtract 11 from the current number.

Given two integers startValue and target, return the minimum number of operations required to display the integer target.

Constraints:

  • 1≤1 \le startValue, target ≤109\le 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Broken Calculator

med
30 min
Try to solve the Broken Calculator problem.

Statement

There is a broken calculator displaying the integer startValue. In one operation, you can perform one of the following actions:

  • Multiply the current number by 22.

  • Subtract 11 from the current number.

Given two integers startValue and target, return the minimum number of operations required to display the integer target.

Constraints:

  • 1≤1 \le startValue, target ≤109\le 10^9