# Category Archives: Algorithms

Given two strings A and B that are anagrams of each other, the task is to convert A to B if possible in minimum number… Read More
Given an array arr[] of size N, the task is to find minimum number of steps required to reduce all Array elements to 0 except… Read More
Given an array of strings Arr[]. The task is to sort them in lexicographic order. Examples: Input: Arr[] = {“sort”, “this”, “list”}Output:  [list, sort, this]… Read More
Given a sorted array arr[] consisting of N integers without any duplicates, the task is to find the ranges of consecutive numbers from that array.… Read More
Given an array arr[ ] with even length N, the task is to find the number of cyclic shifts (rotations) possible for this array, such… Read More
Given two integers, N and K, the task is to find the number of permutations of numbers from 0 to N – 1, such that… Read More
Given three strings, ‘X‘, ‘Y‘ and ‘Z‘, the task is to count the number of subsequences of ‘X‘ which is lexicographically greater than or equal… Read More
Given an array A[] and positive integer K, the task is to count the total number of pairs in the array whose product is divisible… Read More
Given an array arr[] containing N points of 2D plane and a reference point P0 (a0 , b0), the task is to sort these points… Read More
Given two integers N and H, the task is to find the count of distinct Binary Search Trees consisting of N nodes where the maximum… Read More
Given an integer K, the task is to find the maximum possible number having digit sum K and no 0 and same digits consecutively. Examples:… Read More
Given an array A[] of N integers. Consider an integer num such that num occurs in the array A[] and all the positions of num,… Read More
Given an array arr[] of size N and a number K, the task is to find the sum of the first K natural numbers that… Read More
Given an integer N (which is always a power of 2) denoting the length of an array which contains integers in range [0, N-1] exactly… Read More
Given an integer N, the task is to construct a permutation from 1 to N where no adjacent elements have difference as 1. If there… Read More