## Longest subsegment of ‘1’s formed by changing at most k ‘0’s

Given a binary array a[] and a number k, we need to find length of he longest subsegment of ‘1’s possible by changing at most… Read More »

## Maximum difference of zeros and ones in binary string

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

## Count of operations to make a binary string”ab” free

Given a string containing characters ‘a’ and ‘b’ only. Convert the given string into a string in which there is no ‘ab’ substring. To make… Read More »

## Minimum flips to make all 1s in left and 0s in right | Set 2

Given a binary array, we can flip all the 1 are in the left part and all the 0 to the right part.Calculate the minimum… Read More »

## Longest subsequence having equal numbers of 0 and 1

Given a binary array, the task is find the size of the largest sub_sequence which having equal number of zeros and one. Examples : Input… Read More »

## Binary String of given length that without a palindrome of size 3

Given an integer n. Find a string of characters ‘a’ and ‘b’ such that the string doesn’t contain any palindrome of length 3. Examples: Input… Read More »

## Longest subsequence of the form 0*1*0* in a binary string

Given a binary string, find the longest subsequence of the form (0)*(1)*(0)* in it. Basically we need to divide the string into 3 non overlapping… Read More »

## Longest subsequence with no 0 after 1

Given a binary array, find length of the longest subsequence such that there is no 0 after a 1. Examples: Input : 1 1 0… Read More »

## Divisibility by 64 with removal of bits allowed

Given a binary string, we need to check whether that number is divisible by 64 or not after removing of some bits. If yes then… Read More »

## Check if an encoding represents a unique binary string

Given an encoding of a binary string of length k, the task is to find if the given encoding uniquely identifies a binary string or… Read More »

## Length of the longest substring with equal 1s and 0s

Given a binary string. We need to find the length of longest balanced sub string. A sub string is balanced if it contains equal number… Read More »

## Rearrange a binary string as alternate x and y occurrences

Given a binary string s and two integers x and y are given. Task is to arrange the given string in such a way so… Read More »

## Count of substrings of a binary string containing K ones

Given a binary string of length N and an integer K, we need to find out how many substrings of this string are exist which… Read More »

## Print N-bit binary numbers having more 1’s than 0’s in all prefixes

Given a positive integer n, print all n-bit binary numbers having more 1’s than 0’s for any prefix of the number. Examples: Input : n… Read More »

## Sort a binary array using one traversal

Given a binary array, sort it using one traversal and no extra space. Examples : Input : 1 0 0 1 0 1 0 1… Read More »