Given an array arr[] consisting of N integers, the task is to print the last remaining array element after repeatedly selecting pairs of increasing adjacent… Read More

# Category Archives: Pattern Searching

Given two strings str of length N and word of length M, the task is to remove all the occurrences of the string word from… Read More

Given two integers A and B representing coordinates of a point in the first quadrant, the task is to find the minimum number of steps… Read More

Given an array arr[] consisting of a permutation of numbers in the range [0, N – 1], the task is to find the length of… Read More

Given integers current_row and current_col, representing the current position of a Rook on an 8 X 8 chessboard and two more integers destination_row and destination_col… Read More

Given two strings S and T, both of length N and S is an anagram of string T, the task is to convert string S… Read More

Given an integer N(N > 1), the task is to arrange all integers from the range [1, N] in an array such that none of… Read More

Given a string S of length N which is the English representation of any number of digits in the range [0 – 9] in jumbled… Read More

Given an array A[] of size N(1 ≤ N ≤ 105), consisting of positive integers, where the score of an index i in range [0,… Read More

Given an array arr[] of size N, the task is to construct an array brr[] of size N that satisfies the following conditions: In every… Read More

Given a string R(x) of length n representing an expression having the set of words under the given grammar: For every lowercase letter x, R(x)… Read More

Prerequisites: Z-algorithm Given a string S, the task is to find the maximum number of palindromes that can be formed after performing the given steps:… Read More

Given two integers i and j, the task is to print the i * j thmatrix element that can be obtained by filling the matrix… Read More

Given two integers L and R, the task is to find the count of numbers in the range [L, R] whose first and last digit… Read More

Given a string str, the task is to extract the substrings present between two delimiters, i.e. ‘[‘ and ‘]’. Examples: Input: str = “[This is… Read More