Binary numbers represent a value in form of 1’s and 0’s. Python has a bin() method for converting integers to their binary format which makes the execution easy. However, the hard part comes when you have to get the number of consecutive 1’s in the binary value.
Such questions that ask to find the number of consecutive values in a sequence have been quite tough for me so anyone with tips on how to make such questions simpler to understand and work out, I would really appreciate the help.
Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base- 10 integer denoting the maximum number of consecutive 1's in n's binary representation.