Search
⌘K

Leetcode 2749. Minimum Operations to Make the Integer Zero

Given num1 and num2, you may repeatedly subtract values of the form 2^i + num2 (i in [0,60]); find the minimum number of such operations to make num1 exactly 0, or return -1 if impossible. The core challenge is deciding if and how num1 can be expressed as a nonnegative integer combination of the special "coin" set {2^i + num2} and minimizing the count.


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.