## Minimum number of swaps to make two binary string equal

Given two binary strings of equal length, the task is to find the minimum number of swaps to make them equal. Swapping between two characters… Read More »

## Construct Binary Tree from Ancestor Matrix | Top Down Approach

Given an ancestor matrix mat[n][n] where the ancestor matrix is defined as below. mat[i][j] = 1 if i is ancestor of j mat[i][j] = 0,… Read More »

## Generating N-bit Grey Code starting from K

Given a value N and K, the task is to generate N-bits Gray Code starting from the value K. Examples: Input: N = 2, K… Read More »

## Find Maximum Length Of A Square Submatrix Having Sum Of Elements At-Most K

Given a N x M matrix where N is the number of rows and M is the number of columns in the given matrix and… Read More »

## Find Number of Even cells in a Zero Matrix after Q queries

Given a Zero matrix of N x N size, the task is to find the numbers of cells containing even numbers after performing Q queries.… Read More »

## Minimum cost to build N blocks from one block

Given a number N, the task is to build N blocks from 1 block by performing following operation: Double the number of blocks present in… Read More »

## Check if all bits can be made same by flipping two consecutive bits

Given a binary string, the task is to find whether all the digits of the string can be made equal i.e either 0 or 1… Read More »

## Maximize the number of palindromic Strings

Given N binary strings b1, b2, b3…. bn. The task is to find the maximum number of binary strings that you can make palindromic by… Read More »

## Minimum changes required to make all element in an array equal

Given an array of length N, the task is to find minimum operation required to make all elements in the array equal. Operation is as… Read More »

## Maximize distance between any two consecutive 1’s after flipping M 0’s

Given the size of a binary array consisting of 0’s only as n and an integer m which is the number of flips allowed from… Read More »

## Find the smallest subarray having atleast one duplicate

Given an array arr of N elements, the task is to find the length of the smallest subarray of the given array that contains at… Read More »

## Find the distance between two person after reconstruction of queue

Given a 2D array of size N containing distinct height of people standing in a queue, and a number corresponding to each person (P) that… Read More »

## Count of non-empty sequences of a String

Given a string s, the task is to find the number of possible non-empty sequences of letters that can be made. Examples: Input: “AAB” Output:… Read More »

## Find the minimum cost to cross the River

Given an integer N which is the number of villagers who need to cross a river but there is only one boat on which a… Read More »

## Find last two remaining elements after removing median of any 3 consecutive elements repeatedly

Given a sequence A1, A2, A3, … An of distinct integers. The task is to find the last 2 remaining elements after removing the median… Read More »