Data Structure
Java
Python
HTML
Interview Preparation
Tutorials
Courses
Tracks
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.0K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Strings
2.1K+ articles
Greedy
1.4K+ articles
Searching
1.0K+ articles
subarray
658+ articles
substring
358+ articles
prefix
148+ articles
Suffix
41 posts
Recent Articles
Popular Articles
CSES Solutions – Finding Borders
Last Updated: 23 July 2025
A border of a string S is a prefix that is also a suffix of the string but not the whole string. For example, the borders of "abcababcab" are "ab" and "abcab" Your task is...
read more
Competitive Programming
prefix
Suffix
CSES Problems
Suffix Automation
Last Updated: 18 January 2024
In computer science, a suffix automaton is an efficient data structure for representing the substring index of a given string which allows the storage, processing, and ret...
read more
Picked
DSA
Suffix
Geeks Premier League 2023
Precomputation
Construct a String from another String using Suffix Trie
Last Updated: 23 November 2023
A suffix tree is a data structure based on trie compression that stores all the suffixes of a given string. Apart from detecting patterns in strings, it has a range of app...
read more
Strings
Picked
DSA
Trie
Suffix
Suffix Sum Array
Last Updated: 09 November 2023
Suffix Sum ArrayGiven an array arr[] of size N, the task is to compute and return its suffix sum array.Suffix Sum is a precomputation technique in which the sum of all the...
read more
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
suffix-sum
Suffix
Minimum common sum from K arrays after removing some part of their suffix
Last Updated: 23 July 2025
Given K (K 2) arrays of different sizes in a 2D list arr[][] where elements in each array are non-negative. Find the minimum common sum of K arrays after removing part of...
read more
Misc
Greedy
DSA
Arrays
prefix-sum
prefix
Suffix
Check if given String is prefix subarray of the given Array
Last Updated: 12 May 2022
Given a string str and an array of words word[], the task is to find whether str is a prefix string of word[].Examples:Input: str = "indiaismycountry", word[] = {"india", ...
read more
Strings
Greedy
DSA
Arrays
prefix
Suffix
Find indices having at least K non-increasing elements before and K non-decreasing elements after them
Last Updated: 23 July 2025
Given an array arr[] of size N and an integer K, the task is to find all the indices in the given array having at least K non-increasing elements before and K non-decreasi...
read more
DSA
prefix
Suffix
Minimize the number of operations to make all the elements equal with given conditions
Last Updated: 21 February 2022
Given an array arr[]. The task is to minimize the number of operations required to make all the elements in arr[] equal. It is allowed to replace any element in arr[] with...
read more
Greedy
DSA
Arrays
Suffix
Minimum count of prefixes and suffixes of a string required to form given string
Last Updated: 23 July 2025
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 str1. If the task is not possible, ret...
read more
Strings
Dynamic Programming
DSA
HashSet
prefix
Suffix
Count of indices for which the prefix and suffix product are equal
Last Updated: 23 July 2025
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 equal.Example:Input: arr = [4, -5, 1, 1...
read more
Greedy
Mathematical
DSA
Arrays
prefix
Suffix
Find the suffix factorials of a suffix sum array of the given array
Last Updated: 23 July 2025
Given an array arr[] consisting of N positive integers, the task is to find the suffix factorials of a suffix sum array of the given array.Examples:Input: arr[] = {1, 2, 3...
read more
DSA
factorial
suffix-sum
Suffix
Search a string in the dictionary with a given prefix and suffix for Q queries
Last Updated: 23 July 2025
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 to find any one string in the given array w...
read more
Strings
Tree
Advanced Data Structure
DSA
Trie
prefix
Suffix
Length of all prefixes that are also the suffixes of given string
Last Updated: 23 July 2025
Given a string S consisting of N characters, the task is to find the length of all prefixes of the given string S that are also suffixes of the same string S.Examples:Inpu...
read more
Strings
Queue
DSA
prefix
deque
substring
Suffix
Check if count of substrings in S with string S1 as prefix and S2 as suffix is equal to that with S2 as prefix and S1 as suffix
Last Updated: 23 July 2025
Given three strings S, S1, and S2, the task is to check if the number of substrings that start and end with S1 and S2 is equal to the number of substrings that start and e...
read more
Misc
Strings
Searching
DSA
prefix
substring
Suffix
Calculate absolute difference between minimum and maximum sum of pairs in an array
Last Updated: 23 July 2025
Given an array arr[] consisting of N integers, the task is to find the absolute difference between the minimum and maximum sum of any pairs of elements (arr[i], arr[j]) su...
read more
Technical Scripter 2020
DSA
Suffix
1
2
3