Given two integers N and K, the task is to print the first K bits of the Nth term of the Thue-Morse sequence. The Thue-Morse… Read More

# Tag Archives: binary-string

A binary string S of length N is constructed from a string P of N characters and an integer X. The choice of the ith… Read More

Given a binary array arr[] of size N, and an integer K, the task is to check if K 0s can be flipped such that… Read More

Given a binary string S of size N, and a 2D array Q[][] of queries consisting of M pairs of the form {L, R}, the… Read More

Given a binary string S consisting of 0’s and 1’s, The task is to find the minimum number of flips required to generate a binary… Read More

Given two integers N and M (1 ≤ N, M ≤ 100) denoting the total number of 1s and 0s respectively. The task is to… Read More

Given binary string str, the task is to choose any index and change into 0 or 1, and do this in minimum steps such that… Read More

Given a binary string str. The task is to find the size of the set(contains unique substrings) of substrings such that if there is a… Read More

Given two binary strings s1 and s2, the task is to count the minimum operations to convert string s1 to s2. In one operation a… Read More

Given a binary string S containing N characters, the task is to find the maximum distance between two adjacent 1’s. Examples: Input: S = “1010010”Output:… Read More

Given a binary string str. The task is to minimize the number of replacements of ‘0’ by ‘1’ or ‘1’ by ‘0’ to balance the… Read More

Given an integer N, the task is to generate all the binary strings with equal 0s and 1s. If no strings are possible, print -1… Read More