leetle

Daily challenge for 2025-02-02

33. Number of Steps to Reduce to Zero

Write a function solve that returns the number of steps to reduce a non-negative integer to zero. If it's even, divide by 2; if it's odd, subtract 1. Example:
Input: 14
Output: 6
Explanation: 14 -> 7 -> 6 -> 3 -> 2 -> 1 -> 0

Run this challenge interactively in Python or JavaScript when the app loads.