We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
First, they convert the number to binary.
As bin() returns binary numbers but with '0b' as prefix. That's why we only used [2:0].
Now we spilt our number from wherever 0 occurs.
e.g. : 1101101110 : [11,11,111]
We 'll have a list of this kind,
At last we return who has maximum length.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
First, they convert the number to binary. As bin() returns binary numbers but with '0b' as prefix. That's why we only used [2:0]. Now we spilt our number from wherever 0 occurs. e.g. : 1101101110 : [11,11,111] We 'll have a list of this kind, At last we return who has maximum length.