🗼 Prefix Tower Alignment
Find the longest common prefix and build the tower higher!
Stack Words
Find Prefix
Auto Find
🏗️ Prefix Tower
✨ Longest Common Prefix
-
0
Prefix Length
0
Words
0
Checking Column
🔮 Longest Common Prefix Algorithm
function
longestCommonPrefix
(words):
if
words.isEmpty():
return
""
prefix = ""
for
col = 0
to
minLength:
char = words[0][col]
// First word's char
for each
word
in
words:
if
word[col] != char:
return
prefix
prefix += char
// All match!
return
prefix