Longest common prefix · Plus long préfixe commun
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.
Préfixe commun le plus long
Retournez la plus longue chaîne qui commence chaque mot dans le tableau. Pour flower, flow, flight c'est fl ; s'il n'y a rien en commun, retournez "". Commencez avec le premier mot comme hypothèse et réduisez-le face à chaque mot suivant jusqu'à ce qu'il corresponde à tous.
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. · Complétez longestCommonPrefix(String[] strs) retournant le plus long préfixe partagé par chaque chaîne. Retournez une chaîne vide s'il n'y en a pas ou si le tableau est vide.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.