Longest common prefix · Prefijo común más largo
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.
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.
Complete longestCommonPrefix(String[] strs) returning the longest prefix shared by every string. Return an empty string if there is none or the array is empty. · Completa longestCommonPrefix(String[] strs) devolviendo el prefijo más largo compartido por cada cadena. Devuelve una cadena vacía si no hay ninguno o el array está vacío.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.