My-LeetCode-Solvings

C# Code Challenges Solved on LeetCode


Project maintained by F4NT0 Hosted on GitHub Pages — Theme by mattgraham

1342. Number of Steps to Reduce a Number to Zero

Level: Easy

Language: C#

Topic: Math

Unit Tests: 1342 - Testing Results


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

In one step, if the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it.

Example 1:

Example 2:

Example 3:

Constraints: