Skip to content

Tag Archives: prefix

Given an array arr[] of integers, the task is to find the number of indices for which the prefix product and the suffix product are… Read More
Given an integer N and a vector of strings prefixes[], the task is to calculate the total possible strings of length N from characters ‘0’… Read More
Given two strings str1 and str2, the task is to find the minimum number of prefixes and suffixes of str2 required to form the string… Read More
Given a ternary string S of length N containing only ‘0’, ‘1’ and ‘2’ characters and Q queries containing a range of indices [L, R],… Read More
Given two arrays A[] and B[] both consisting of N integers, the task is to find the number of non-decreasing arrays of size N that… Read More
Given an array arr of size N, the task is to find the number of its permutations such that the sum of MEXs of its… Read More
Given an array arr[] consisting of N strings and a string S if size M, the task is to find the lexicographically smallest string consisting… Read More
Given an array arr[] of N integers, the task is to find the minimum number of increments/decrements of array elements by 1 to make the… Read More
Given an array arr[] consisting of N strings and Q queries in form of two strings prefix and suffix, the task for each query is… Read More
Given an array arr[](1-based indexing) consisting of N positive integers and two positive integers L and R,  the task is to find the sum of… Read More
Given an array arr[] consisting of N integers, the task is to find the longest subsequence such that the prefix sum at each position of… Read More
Given a matrix, arr[][] of dimensions M*N, and an integer S, the task is to print the count of the number of subsquares of the… Read More
Given an array arr[] of N integers, the task is to find the maximum prefix length of the array such that removing exactly one element… Read More
Given an array arr[], the goal is to count the number of inversions in all the sub-arrays. An inversion is a pair of indices i… Read More
Given an array, arr[] of size N and an integer T. The task is to find for each index the minimum number of indices that… Read More

Start Your Coding Journey Now!