Question: Python Write a function that, given a binary number as a string, computes the maximum number of consecutive ones. For example, for the binary string

Python

Python Write a function that, given a binary number as a string,

Write a function that, given a binary number as a string, computes the maximum number of consecutive ones. For example, for the binary string '0100111100000100111', the answer should be 4. Using your code, compute the maximum number of consecutive ones for the following strings: . '0' . '000001' . '1111' . '110011001' Note the following: . You are not allowed to use any built-in function that computes consecutive numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!