Hackerrank 30 days of code Java Solution: Day 10: Binary Numbers

The next problem is based on Binary numbers.The number to binary conversion and vice versa is the motive of this day. Again I would recommend to watch the tutorial for this lesson, it will brief you about the mathematics involved in conversion.

Given a base-10 integer,n , convert it to binary (base-)2. Then find and print the base- integer denoting the maximum number of consecutive ‘s in ‘s binary representation.

Sample Input

Sample Output

Sample Input

Sample Output

So here the Solution you have landed here for..

Hope you like the post.. 🙂


  1. Your opinion on options differs from most of the blogs I browse, I’m pleased.

  2. can we get test cases of this problem of hackerrank

  3. I hope that it’s acceptable that I write about this with just a few
    of my clients, this’ll help their knowledge of
    binary tremendously.

Leave a Reply

Your email address will not be published. Required fields are marked *