## Count number of ways to cover a distance | Set 2

Given a distance N. The task is to count the total number of ways to cover the distance with 1, 2 and 3 steps. Examples:… Read More »

## Number of binary strings such that there is no substring of length ≥ 3

Given an integer N, the task is to count the number of binary strings possible such that there is no substring of length ≥ 3… Read More »

## Number of square matrices with all 1s

Given an N*M matrix containing only 0s and 1s, the task is to count the number of square submatrices containing all 1s. Examples: Input: arr[][]… Read More »

## Count number of increasing sub-sequences : O(NlogN)

Given an array arr[] of length N, the task is to find the number of strictly increasing sub-sequences in the given array. Examples: Input: arr[]… Read More »

## Median of sliding window in an array

Given an array of integer arr[] and an integer k, the task is to find the median of each window of size k starting from… 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 »

## 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 »

## Sum of all numbers formed having 4 atmost X times, 5 atmost Y times and 6 atmost Z times

Given three integers X, Y and Z, the task is to find the sum of all the numbers formed having 4 atmost X times, 5… Read More »

## Size of the largest divisible subset in an Array

Given an array arr[] of size N. The task is to find the size of the set of numbers from the given array such that… Read More »

## Count of 1’s in any path in a Binary Tree

Given a binary tree of 0s and 1s, the task is to find the maximum number of 1s in any path in the tree. The… Read More »

## Minimize the sum of differences of consecutive elements after removing exactly K elements

Given a sorted array of length ‘N’ and an integer ‘K'(K<N), the task is to remove exactly 'K' elements from the array such that sum… Read More »

## Longest sub-sequence of a binary string divisible by 3

Given a binary string S of length N, the task is to find the length of the longest sub-sequence in it which is divisible by… Read More »

## Number of sub-sequences of non-zero length of a binary string divisible by 3

Given a binary string S of length N, the task is to find the number of sub-sequences of non-zero length which are divisible by 3.… Read More »

## Number of ways to convert a character X to a string Y

Given a character X and a string Y of length N and the task is to find the number of ways to convert X to… Read More »

## Maximum value obtained by performing given operations in an Array

Given an array arr[], the task is to find out the maximum obtainable value. The user is allowed to add or multiply the two consecutive… Read More »