Skip to content

Category Archives: Algorithms

Given a string S of size N consisting of digits [1, 9], the task is to find the length of the smallest subsequence in the… Read More
Given an array arr[] consisting of N positive integers, where N is even, the task is to form N/2 pairs such that the sum of… Read More
Given a positive integer M and an array arr[] of size N and a few integers are missing in the array represented as -1, the… Read More
Given two integers L and R, the task is to find the count of unordered pairs of integers (A, B) in the range [L, R]… Read More
Given two integers L and R, the task is to find the count of integers in the range [L, R] such that the frequency of… Read More
Given a string str[] of lower-case characters, the task is to make all characters of the string equal in the minimum number of operations such… Read More
Given a Generic Tree consisting of N nodes, the task is to find the ZigZag Level Order Traversal of the given tree. Examples: Input: Output:13… Read More
Given an integer K and an array arr[] having N pairwise distinct integers in the range [1, K], the task is to find the lexicographically… Read More
Given an array arr[] consisting of N distinct positive integers and a range [L, R], the task is to find the element in the given… Read More
Given a string S, in one move it is allowed to remove two adjacent equal characters. After the removal, both endpoints of the removed characters… Read More
Given an array arr[] of positive integers, the task is to select an element from the array and delete all its occurrences, such that the… Read More
Given a string S and an array of equal length words (strings) arr[]. The task is to find the minimum start index of the substring… Read More
Given two arrays pre[] and in[] representing the preorder and inorder traversal of the binary tree, the task is to check if the given traversals… Read More
Given an undirected graph consisting of N nodes and M edges, the task is to find the minimum length of the path from Node 1… Read More
Given a string S consisting of N digits, the task is to partition the string into at most two increasing subsequences such that concatenation of… Read More