Number of Steps to Reduce a Number in Binary Representation to One
Given a binary string s, you need to reduce it to 1 in the fewest number of steps. In each step, if the current number is even, you replace it with the number divided by 2; otherwise, you replace it with the number minus one. Return the minimum number of steps to reduce the binary representation of the given number to one.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)