Search⌘ K
AI Features

Number of Steps to Reduce a Binary Number to One

Number of Steps to Reduce a Binary Number to One asks you to count the operations needed to turn a binary string into one, adding one when its value is odd and dividing it by two when even.

Statement

You are given a string, str, as a binary representation of an integer. Your task is to return the number of steps needed to reduce it to ...