String
1404. Number of Steps to Reduce a Number in Binary Representation to One
A binary number as a string; each step, halve it if even (drop the last bit) or add 1 if odd; count steps to reach 1. Simulating with big-integer arithmetic is unnecessary — process the bits right to…
Loading…