## Number of valid indices in the permutation of first N natural numbers

Given a permutation P of first N natural numbers. The task is to find the number of i’s such that Pi ≤ Pj for all… Read More »

## Check if Sum and XOR of all elements of array is equal

Given an array arr[], the task is to check if sum of all elements of an array is equal to XOR of all elements of… Read More »

## Arrange numbers to form a valid sequence

Given an array arr[] with N distinct numbers and another array arr1[] with N-1 operators (either < or >), the task is to organize the… Read More »

## Count the subarray with sum strictly greater than the sum of remaining elements

Given an array arr[] of N positive integers, the task is to count all the subarrays where the sum of subarray elements is strictly greater… Read More »

## Find smallest number with given number of digits and sum of digits under given constraints

Given two integers S and D, the task is to find the number having D number of digits and the sum of its digits as… Read More »

## Count of odd length contiguous Palindromic sequences in a Matrix

Given a matrix arr[][] of size MxN, the task is to find the number of contiguous palindromic sequences of odd length in that matrix. Example:… Read More »

## Count of even and odd power pairs in an Array

Given an array arr[] of length N, the task is to count the number of pairs (X, Y) such that XY is even and count… Read More »

## Count of pairs satisfying the given condition

Given two integers A and B, the task is to calculate the number of pairs (a, b) such that 1 ≤ a ≤ A, 1… Read More »

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

## Reduce a number to 1 by performing given operations | Set 2

Given an integer N. The task is to reduce the given number N to 1 in minimum number of given operations. You can perform any… Read More »

## Minimum integer that can be obtained by swapping adjacent digits of different parity

Given an integer N, the task is to find the minimum integer that can be obtained from the given integer such that the adjacent digits… Read More »

## Jaro and Jaro-Winkler similarity

Jaro Similarity Jaro Similarity is the measure of similarity between two strings. The value of Jaro distance ranges from 0 to 1. where 1 means… 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 »

## Partitions possible such that the minimum element divides all the other elements of the partition

Given an integer array arr[], the task is to count the number of partitions possible such that in each partition the minimum element divides all… Read More »

## Partition the digits of an integer such that it satisfies a given condition

Given an integer X, the task is to partition its digit into two groups either A or B such that the sequence of digits is… Read More »