Given a string, find the longest substring that reads the same forwards and backwards. This classic problem appears everywhere: text editors implementing ‘find palindrome’ features, DNA sequence…
Read more →
Before diving into the algorithm, let’s clarify terminology that trips up many engineers. A subsequence maintains relative order but allows gaps—from ‘character’, you can extract ‘car’ or ‘chr’….
Read more →
The longest palindromic substring problem asks you to find the longest contiguous sequence of characters within a string that reads the same forwards and backwards. Given ‘babad’, valid answers…
Read more →
The Longest Repeated Substring (LRS) problem asks a deceptively simple question: given a string, find the longest substring that appears at least twice. The substrings can overlap, which makes the…
Read more →
The Longest Common Subsequence (LCS) problem asks a deceptively simple question: given two strings, what’s the longest sequence of characters that appears in both, in the same order, but not…
Read more →
The longest common substring problem asks a straightforward question: given two strings, what’s the longest contiguous sequence of characters that appears in both? This differs fundamentally from the…
Read more →
The Longest Increasing Subsequence (LIS) problem asks a deceptively simple question: given an array of integers, find the length of the longest subsequence where elements are in strictly increasing…
Read more →
The suffix array revolutionized string processing by providing a space-efficient alternative to suffix trees. But the suffix array alone is just a sorted list of suffix positions—it tells you the…
Read more →