Tap here to switch tabs
Problem
Submissions

Problem: Number of Steps to Reduce a Number to Zero

med
30 min
Try to solve the Number of Steps to Reduce a Number to Zero problem.

Statement

Given an integer num, return the number of steps required to reduce it to 00.

In each step, if the current value of num is even, divide it by 22. Otherwise, subtract 11 from it.

Constraints:

  • 0≤0 \leq num ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Steps to Reduce a Number to Zero

med
30 min
Try to solve the Number of Steps to Reduce a Number to Zero problem.

Statement

Given an integer num, return the number of steps required to reduce it to 00.

In each step, if the current value of num is even, divide it by 22. Otherwise, subtract 11 from it.

Constraints:

  • 0≤0 \leq num ≤106\leq 10^6