# Tag Archives: binary-string

## Count of binary strings of given length consisting of at least one 1

Given an integer N, the task is to print the number of binary strings of length N which at least one ‘1’. Examples: Input: 2… Read More »

## Count of binary strings of length N with even set bit count and at most K consecutive 1s

Given two integers N and K, the task is to find the number of binary strings of length N having an even number of 1’s… Read More »

## Minimum flips required in a binary string such that all K-size substring contains 1

Given a binary string str of size N and a positive integer K, the task is to find the minimum number of flips required to… Read More »

## Build a DFA to accept a binary string containing “01” i times and “1” 2j times

Given a binary string str, the task is to build a DFA that accepts given binary string if it contains “01” i times and “1”… Read More »

## Minimum jumps required to group all 1s together in a given Binary string

Given a binary string S, the task is to count the minimum number of jumps required to group all 1’s together. Examples: Input: S =… Read More »

## Minimum flips required to form given binary string where every flip changes all bits to its right as well

Given a string S, the task is to find minimum flips required to convert an initial binary string consisting of only zeroes to S where… Read More »

## Minimum bit flips such that every K consecutive bits contain at least one set bit

Given a binary string S, and an integer K, the task is to find the minimum number of flips required such that every substring of… Read More »

## Build a DFA to accept Binary strings that starts or ends with “01”

Given a binary string str, the task is to build a DFA that accepts the string if the string either starts with “01” or ends… Read More »

## Maximum number of set bits count in a K-size substring of a Binary String

Given a binary string S of size N and an integer K. The task is to find the maximum number of set bit appears in… Read More »

## Longest subsequence possible that starts and ends with 1 and filled with 0 in the middle

Given a binary string s, the task is to find the length of longest subsequence that can be divided into three substrings such that the… Read More »

## Minimum flips required to generate continuous substrings of 0’s and 1’s

Given a binary string S of length N, the task is to find the minimum number of bit flips required to convert the given string… Read More »

## Minimum Group Flips to Make Binary Array Elements Same

Given a binary array, we need to convert this array into an array that either contains all 1s or all 0s.  We need to do… Read More »

## Split a binary string into K subsets minimizing sum of products of occurrences of 0 and 1

Given a binary string S, the task is to partition the sequence into K non-empty subsets such that the sum of products of occurences of… Read More »

## Binary string with given frequencies of sums of consecutive pairs of characters

Given three integers P, Q, and R, the task is to generate a binary string with P, Q and R pairs of consecutive characters with… Read More »

## Minimum flips required to keep all 1s together in a Binary string

Given a binary string str, the task is to find the minimum number of flips required to keep all 1s together in the given binary… Read More »