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
Misc
7.7K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Strings
2.1K+ articles
Greedy
1.4K+ articles
substring
358+ articles
prefix-sum
348+ articles
Suffix
41+ articles
prefix
148+ 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
CSES Solutions - Substring Distribution
Last Updated: 23 July 2025
You are given a string of length N. For every integer between 1 to N you need to print the number of distinct substrings of that length.Prerequisites to Solve this problem...
read more
Strings
DSA
prefix
CSES Problems
Longest Valid Word with All Prefixes
Last Updated: 03 July 2025
Given an array of strings arr[], find the longest string such that all of its prefixes are also present in arr[]. If there are multiple such strings with the same maximum ...
read more
Strings
DSA
Trie
prefix
Prefix Xor Array
Last Updated: 24 July 2025
Given an arrayarr[]of sizeN, find the Prefix Xor of the array. A prefix xor array is another arrayprefixXor[]of the same size, such that the value ofprefixXor[i]isarr[0] ^...
read more
DSA
Bitwise-XOR
prefix
Maximize Array sum by replacing middle elements with min of Subarray corners
Last Updated: 04 December 2023
Given an array A[] of length N. Then your task is to output the maximum sum that can be achieved by using the given operation at any number of times (possibly zero):Select...
read more
Geeks Premier League
DSA
Arrays
subarray
prefix
Geeks Premier League 2023
Minimum sum of Quotients after performing the given operation
Last Updated: 23 July 2025
Given an array A[] of length N, we can change the value of exactly one element of the array to any integer greater than 0, such that the sum of quotients of all the elemen...
read more
Geeks Premier League
DSA
Arrays
Suffix-Array
prefix
Geeks Premier League 2023
Number of K-Spikes in Stock Price Array
Last Updated: 23 July 2025
Given the changes to stock price over a period of time as an array of distinct integers, count the number of spikes in the stock price which are counted as K-Spikes. A K-S...
read more
DSA
SAP-Labs-Question
Suffix-Array
prefix
Set
Find the increased sum of the Array after P operations
Last Updated: 01 October 2023
Given an array arr[] of non-negative integers of size N and an integer P. Neighboring values of every non-zero element are incremented by 2 in each operation, the task is ...
read more
DSA
Arrays
Suffix-Array
prefix
Total cuts such that sum of largest of left and smallest of right is atleast K
Last Updated: 14 July 2023
Given an array A[] of size N and an integer K, the task is to find the total number of cuts that you can make such that for each cut these two conditions are satisfied:A c...
read more
DSA
Arrays
prefix
Finding absolute difference of sums for each index in an Array
Last Updated: 13 September 2023
Given an array arr[] of size N, find a new array ans[] where each index i represents the absolute difference between the sum of elements to the left and right of index i i...
read more
DSA
Arrays
prefix-sum
Suffix-Array
Arrays
prefix
suffix-sum
Split a String into two Substring such that the sum of unique characters is maximum
Last Updated: 11 April 2023
Given a string str, the task is to partition the string into two substrings such that the sum of unique characters of both substrings is the maximum possible.Examples:Inpu...
read more
DSA
Arrays
prefix
suffix-sum
Count permutations whose prefix & suffix AND are same for each index
Last Updated: 23 July 2025
Given an array arr[] of size N, Return the number of permutations of array arr[] which satisfy the condition arr[1] arr[2] . . . arr[i] = arr[i+1] arr[i+2] . . . arr...
read more
Bit Magic
Sorting
DSA
Arrays
prefix
Bitwise-AND
Find element which maximize the XOR value for N given update query
Last Updated: 23 July 2025
Given arrays Arr[] and Queries[] of size N and an integer K such that (0 ≤ Arr[i], Queries[i] 2K), the task is to form an array, where each element represents an integer ...
read more
Bit Magic
DSA
Arrays
BIT
prefix
Create Array following condition such that exactly M prefixes have positive Sum
Last Updated: 23 July 2025
You are given two integers N and M (M ≤ N), the task is to create an array of length N following the below-given conditions.|Ai| = i, Formally, A[i] will be either -i or i...
read more
Technical Scripter
Technical Scripter 2022
DSA
Arrays
prefix
Count of Strings of Array having given prefixes for Q query
Last Updated: 23 July 2025
Given two arrays of strings containing words[] and queries[] having N and Q strings respectively, the task is to find the number of strings from words[] having queries[i] ...
read more
Strings
Pattern Searching
Technical Scripter
Picked
Technical Scripter 2022
DSA
Trie
prefix
1
2
3
4
...
10