C program to count zeros and ones in binary representation of a number
Given a number N, the task is to write C program to count the number of 0s and 1s in the binary representation of N....
read more
Program to convert a binary number to hexadecimal number
Given a Binary Number, the task is to convert the given binary number to its equivalent hexadecimal number. The input could be very large and may not fit even into an unsigned long long int....
read more
Count the number of mappings in given binary matrix based on given conditions
Given a binary matrix of size M*N containing only 0 and 1. The task is to count the number of mappings in the matrix. There is one mapping between any two 1s if the following conditions are satisfied:...
read more
Maximize difference between odd and even-indexed array elements by rotating their binary representations
Given an array arr[] consisting of N positive integers, the task is to find the maximum absolute difference between the sum of the array elements placed at even indices and those at odd indices of the array by rotating their binary representations any number of times. Consider only 8-bit representation....
read more
Decimal representation of given binary string is divisible by 10 or not
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 be very large and may not fit even in long long int. The approach should be such that there are zero or minimum number of multiplication and division operations. No leading 0’s are there in the input.Examples:...
read more
Program to convert a binary number to octal
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 not fit even into unsigned long long int....
read more
XOR in a range of a binary array
Given a binary array arr[] of size N and some queries. Each query represents an index range [l, r]. The task is to find the xor of the elements in the given index range for each query i.e. arr[l] ^ arr[l + 1] ^ … ^ arr[r]....
read more
Queries to answer the number of ones and zero to the left of given index
Given a binary array and Q queries. Every query consists of a number K, the task is to print the number of ones and zeros to the left of the index K. Examples:...
read more
Check if it is possible to create a matrix such that every row has A 1s and every column has B 1s
Given four integers N, M, A, B where N is the number of rows and M is the number of columns, the task is to check if is possible to create a binary matrix of dimensions N x M such that every row has A number of 1s and every column has a B number of 1s. If any such matrix is possible then print it else print “-1”....
read more
Minimum sum of array elements based on given Criteria
Given an array A[] of size N with entries as integers, some of the entries are -1. The task is to replace -1’s with numbers satisfying the below criteria....
read more
Maximize minority character deletions that can be done from given Binary String substring
Python...
read more
Convert decimal fraction to binary number
Given a fraction decimal number n and integer k, convert decimal number n into equivalent binary number up-to k precision after decimal point....
read more