Skip to content

Missing Test Case - 2749. Minimum Operations to Make the Integer Zero #32007

@Melisha2904

Description

@Melisha2904

LeetCode Username

Melisha2904

Problem Number, Title, and Link

https://leetcode.com/problems/minimum-operations-to-make-the-integer-zero/description/?envType=daily-question&envId=2025-09-05

Bug Category

Problem hints

Bug Description

You have a starting number.
In each step, you take away a chunk that looks like “a power of two plus num2.”
After some steps, what’s left should exactly match a mix of powers of two.
So we test step counts (1 to 60).
For each count, we check if the remaining number is non-negative, big enough, and can be split into that many powers of two.
If yes, that count is the answer.
If no count works, then it’s impossible, so answer is -1.

Language Used for Code

Java

Code used for Submit/Run operation

Expected behavior

You start with a number num1.

Each move, you take away (2^i + num2) from it.

After k moves, the leftover must be made only from powers of two (like 1, 2, 4, 8...).

So we check for each k (1 to 60):

Is the leftover (num1 - k*num2) not negative?

Can it be broken into at most k powers of two?

Is it big enough for k moves?

The first k that works is the answer. If none works, answer is -1.

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions