Skip to content · ⁨Saltar al contenido⁩

Longest common prefix · ⁨Prefijo común más largo⁩

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.

Español

Prefijo común más largo

Devuelve la cadena más larga que comience todas las palabras del array. Para flower, flow, flight el resultado es fl; si no hay nada en común, retorna "". Comienza con la primera palabra como suposición y acórtala contra cada palabra siguiente hasta que coincida con todas.

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP