Search
⌘K

Leetcode 991. Broken Calculator

Given startValue and target, compute the minimum operations to reach target using multiply-by-2 and minus-1; the optimal approach is to work backwards from target applying inverse operations (if target is even divide by 2, if odd add 1) until it drops to or below start, then finish by taking the remaining differences.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.