43
4
Given an integer n > 0, output the length of the longest contiguous sequence of 0 or 1 in its binary representation.
Examples
6is written110in binary; the longest sequence is11, so we should return216→10000→4893→1101111101→51337371→101000110100000011011→61→1→19965546→100110000000111111101010→7
8OEIS A043276 – alephalpha – 2017-01-13T04:45:25.197
Can we assume any bound of the size of the integer like 32 bit or 64 bit? – xnor – 2017-01-13T05:55:11.670
@xnor yes you can assume the int is 32 bits max – Arnaud – 2017-01-13T06:20:52.257