# Tag Archives: binary-representation

## Decimal representation of given binary string is divisible by 10 or notOctober 2, 2017

The problem is to check whether the decimal representation of the given binary number is divisible by 10 or not. Take care, the number could… Read More »

## Prime Number of Set Bits in Binary RepresentationSeptember 26, 2017

Given two integers ‘L’ and ‘R’, we need to write a program that finds the count of numbers having prime number of set bits in… Read More »

## Binary representation of previous numberSeptember 13, 2017

Given a binary input that represents binary representation of positive number n, find binary representation of n-1. It may be assumed that input binary number… Read More »

## Longest common substring in binary representation of two numbersAugust 5, 2017

Given two integers n and m. Find the longest contiguous subset in binary representation of both the numbers and its decimal value. Example 1: Input… Read More »

## Check if binary representation of a given number and its complement are anagramJuly 31, 2017

Given a positive number you need to check whether it’s complement and the number are anagrams or not. Examples: Input : a = 4294967295 Output… Read More »

## 1 to n bit numbers with no consecutive 1s in binary representation.July 27, 2017

Given a number n, our task is to find all 1 to n bit numbers with no consecutive 1s in their binary representation. Examples: Input… Read More »

## Program for Decimal to Binary ConversionJuly 5, 2017

Given a decimal number as input, we need to write a program to convert the given decimal number into equivalent binary number. Examples: Input :… Read More »

## Program for Binary To Decimal Conversion

Given a binary number as input, we need to write a program to convert the given binary number into equivalent decimal number. Examples: Input :… Read More »

## Queries for decimal values of subarrays of a binary arrayJuly 3, 2017

Given a binary array arr[], we to find the number represented by the subarray a[l..r]. There are multiple such queries. Examples: Input : arr[] =… Read More »

## Convert a binary number to octalJune 30, 2017

The problem is to convert the given binary number (represented as string) to its equivalent octal number. The input could be very large and may… Read More »

## Position of rightmost different bitJune 29, 2017

Given two numbers m and n. Find the position of rightmost different bit in binary representation of numbers. It is guaranteed that such a bit… Read More »

## Decimal representation of given binary string is divisible by 5 or notJune 7, 2017

The problem is to check whether the decimal representation of the given binary number is divisible by 5 or not. Take care, the number could… Read More »

## Convert a binary number to hexadecimal numberMay 28, 2017

The problem is to convert the given binary number to its equivalent hexadecimal number. The input could be very large and may not fit even… Read More »

## Converting a Real Number (between 0 and 1) to Binary StringMay 26, 2017

Given a real number between 0 and 1 (e.g., 0.72) that is passed in as a double, print the binary representation. If the number cannot… Read More »

## Binary representation of next numberMay 13, 2017

Given a binary input that represents binary representation of positive number n, find binary representation of n+1. The binary input may be and may not… Read More »