Longest Common Prefix
AlgorithmsEasyFind the longest shared prefix string among a set of multiple words.
Alt+Shift+L
Configuration Panel (One per line)
1
2
3
4
Complexity Indices
Time ComplexityO(S) where S is sum of lengths
Auxiliary SpaceO(1)
Conceptual Overview
Longest Common Prefix (LCP) locates the longest starting substring that is shared across all strings in a given set.
Source: CP-Algorithms reference guide