+ 40
[ ASSIGNMENT: ] Binary Numbers
Given a base-10 integer, n, convert it to binary (base-2). Print a single base-10 integer denoting the maximum number of consecutive 1's in the binary representation of n. Sample Input : 5 Sample Output : 1 The binary representation of 5 is 101, so the maximum number of consecutive 1's is 1. Sample Input : 13 Sample Output : 2 The binary representation of 13 is 1101, so the maximum number of consecutive 1's is 2. HappyCodings!:-)
32 Answers
+ 33
My one-liner in JavaScript
https://code.sololearn.com/WY324e59208k/?ref=app
+ 23
Finally my solution !! 😆
https://code.sololearn.com/cN8eOM4NhvUw/?ref=app
+ 23
https://code.sololearn.com/cfTqfPs5WU9H/?ref=app
+ 16
We finally started !! 👏😆👍
Thank you guys 👏😊😉
all of you !! 👍😆😎
+ 16
Here's my attempt : )
https://code.sololearn.com/cpmxMn383x6r/?ref=app
+ 15
@Pyctam
and ?!!!
I'm Bosnian 😆
+ 15
+ 15
@Russ
Make your code Public !! 😉
+ 14
Man... A little bit complicated, but here is my try.
Good challenge! ✌👍👌
https://code.sololearn.com/c31eOUW1noxR/?ref=app
+ 11
Here’s mine: https://code.sololearn.com/WEnczr97HHTy/?ref=app
+ 11
Here is mine
https://code.sololearn.com/c0CWeufHPutc/?ref=app
+ 11
https://code.sololearn.com/cEA9Z0ev7oqU/?ref=app
+ 9
+ 8
My C++ solution
https://code.sololearn.com/cVCJekO053HT/#cpp
+ 8
hi. my solution in cs
https://code.sololearn.com/c66I5WIZ6hzO/?ref=app
+ 8
My solution in C:
https://code.sololearn.com/csjy7n01TbQB/#c
+ 7
Another one in C
https://code.sololearn.com/cSf7NoRW9l5T/?ref=app
+ 7
I usually make one-liners but this time I was too lazy...
https://code.sololearn.com/c9eFNghiu4fz/?ref=app