## Count binary strings with twice zeros in first half

We are given an integer N. We need to count the total number of such binary strings of length N such that the number of… Read More »

## Minimum rooms for m events of n batches with given schedule

There are n student groups at the school. On each day in school, there are m time slots. A student group may or may not… Read More »

## Check divisibility of binary string by 2^k

Given a binary string and a number k, task is to check whether the binary string is evenly divisible by 2k or not. Examples :… Read More »

## Find nth term of the Dragon Curve Sequence

Dragon Curve Sequence is an infinite binary sequence of 0s and 1s. The first term of the sequence is 1. From the next term, we… Read More »

## Thue-Morse sequence

Thue–Morse sequence, or Prouhet–Thue–Morse sequence, is an infinite binary sequence of 0s and 1s. The sequence is obtained by starting with 0 and successively appending… Read More »

## Construct binary palindrome by repeated appending and trimming

Given n and k, Construct a palindrome of size n using a binary number of size k repeating itself to wrap into the palindrome. The… Read More »

## Minimum adjacent swaps required to Sort Binary array

Given a binary array, task is to sort this binary array using minimum swaps. We are allowed to swap only adjacent elements Examples: Input :… Read More »

## Convert String into Binary Sequence

Given a string of character the task is to convert each character of a string into the equivalent binary number. Examples : Input : GFG… Read More »

## Sort 1 to N by swapping adjacent elements

Given an array A of size N consisting of elements 1 to N. A boolean array B consisting of N-1 elements indicates that if B[i]… Read More »

## Find i’th Index character in a binary string obtained after n iterations

Given a decimal number m, convert it into a binary string and apply n iterations, in each iteration 0 becomes “01” and 1 becomes “10”.… Read More »

## Maximum difference of zeros and ones in binary string | Set 2 (O(n) time)

Given a binary string of 0s and 1s. The task is to find the maximum difference between the number of 0s and number of 1s… Read More »

## Counting even decimal value substrings in a binary string

Given a binary string of size N. Count all substring that have even decimal value considering binary to decimal conversion from left to right (For… Read More »

## Python | Check if there are K consecutive 1’s in a binary number

Given K and a binary number, check if there exists k consecutive 1’s in the binary number. Examples: Input : binary number = 101010101111 k… Read More »

## Number of substrings with odd decimal value in a binary string

Given a binary string containing only 0’s and 1’s. Write a program to find number of sub-strings of this string whose decimal representation is odd.… Read More »

## Count subarrays with equal number of 1’s and 0’s

Given an array arr[] of size n containing 0 and 1 only. The problem is to count the subarrays having equal number of 0’s and… Read More »