Given an array arr[] consisting of N integers, the task is to count the number of tuples (i, j, k, l) from the given array… Read More

# Category Archives: Searching

Given string str of length N only consisting of characters ‘N’, ‘S’, ‘E’, or ‘W’, each representing moving one unit North, South, East, or West,… Read More

Given an array arr[], select any subarray and apply any one of the below operations on each element of the subarray: Increment by one Decrement… Read More

Given a string str, the task is to find the substring of length K which occurs the maximum number of times. If more than one… Read More

Given two strings A and B, the task is to find lexicographically the smallest permutation of string B such that it contains every substring from… Read More

Given an array arr[][] containing pairs of integers in increasing order of GCDs, and an integer K, the task is to find a pair of… Read More

Given a two dimensional array arr[][] of dimensions N * 2 which contains the starting and ending time for N meetings on a given day.… Read More

Check if array can be sorted by swapping pairs having GCD equal to the smallest element in the array

Given an array arr[] of size N, the task is to check if an array can be sorted by swapping only the elements whose GCD… Read More

Given three integers L, R and K where [L, R] denotes the range of elements, the task is to find the element in the range… Read More

Given an alphanumeric string, consisting of a single alphabet X, which represents an expression of the form: A operator B = C where A, B… Read More

Given an alphanumeric string S of length N, the task is to check if the given string represents a hexadecimal number or not. Print Yes… Read More

Given an N-ary tree, the task is to find the maximum width of the given tree. The maximum width of a tree is the maximum… Read More

Given an undirected graph with N vertices and K edges, the task is to check if for every combination of three vertices in the graph,… Read More

Given a stack of integers S and an array of integers arr[], the task is to check if all the array elements are present in… Read More

Given two strings str1 and str2, where str2 is a subsequence of str1, the task is to find the length of the longest substring of… Read More