# Tag Archives: Suffix-Array

## Count of ways to split given string into two non-empty palindromes

Given a string S, the task is to find the number of ways to split the given string S into two non-empty palindromic strings. Examples:… Read More »

## Find the GCD of LCM of all unique pairs in an Array

Given an integer array arr[] of size N, the task is to find the GCD of LCM of all unique pair (i, j) of the… Read More »

## Check if given words are present in a string

Given a big string and an array of small strings, all of which are smaller in length than the big string. The task is to… Read More »

## Remove an element to minimize the LCM of the given array

Given an array arr[] of length N ≥ 2. The task is to remove an element from the given array such that the LCM of… Read More »

## Find the maximum element in the array other than Ai

Given an array arr[] of size N. The task is to find maximum element among N – 1 elements other than arr[i] for each i… Read More »

## Replace elements with absolute difference of smallest element on left and largest element on right

Given an array arr[] of N integers. The task is to replace all the elements of the array by the absolute difference of the smallest… Read More »

## Find the longest sub-string which is prefix, suffix and also present inside the string | Set 2

Given string str. The task is to find the longest sub-string which is a prefix, a suffix and a sub-string of the given string, str.… Read More »

## Find the farthest smaller number in the right side

Given an array arr[] of size N. For every element in the array, the task is to find the index of the farthest element in… Read More »

## Find number of triplets in array such that a[i]>a[j]>a[k] and i<j<k

Given an array arr of size N. The task is to count number of triplets in the array such that a[i]>a[j]>a[k] and i<j<k Examples: Input… Read More »

There are N stations in a straight line, each of them has some non-negative radiation power. Every station can increase the radiation power of its… Read More »

## Find maximum sum taking every Kth element in the array

Given an array arr[] of integers and an integer K, the task is to find the maximum sum taking every Kth element i.e. sum =… Read More »

## Maximize the maximum among minimum of K consecutive sub-arrays

Given an integer K and an array arr[], the task is to split the array arr[] into K consecutive subarrays to find the maximum possible… Read More »

## Queries for number of distinct integers in Suffix

Given an array of N elements and Q queries, where each query contains an integer K. For each query, the task is to find the… Read More »

## Number of balanced bracket subsequence of length 2 and 4

Given a bracket sequence of even length. The task is to find how many ways are there to make balanced bracket subsequences from the given… Read More »

## Find an element which divides the array in two subarrays with equal product

Given, an array of size N. Find an element which divides the array into two sub-arrays with equal product. Print -1 if no such partition… Read More »