Longest common prefix · Maior prefixo comum
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.
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.
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. · Complete longestCommonPrefix(String[] strs) retornando o maior prefixo compartilhado por todas as strings. Retorne uma string vazia se não houver ou se o array estiver vazio.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.