Skip to content · ⁨Pular para o conteúdo⁩

Longest common prefix · ⁨Maior prefixo comum⁩

English

Longest common prefix

Return the longest string that starts every word in the array. For flower, flow, flight it's fl; if there's nothing in common, return "". Start with the first word as a guess and shrink it against each next word until it fits them all.

Português

Maior prefixo comum

Retorne a maior string que começa todas as palavras do array. Para flower, flow, flight é fl; se não houver nada em comum, retorne "". Comece com a primeira palavra como chute e reduza-a contra cada próxima palavra até caber em todas.

Log in or create account · ⁨Entrar ou criar conta⁩

IGCSE, A-Level & AP