Longest common prefix · Tiền tố chung dài nhất
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.
Tiền tố chung dài nhất
Trả về chuỗi dài nhất bắt đầu bằng mọi từ trong mảng. Đối với flower, flow, flight thì đó là fl; nếu không có gì chung, hãy trả về "". Bắt đầu với từ đầu tiên như một giả thuyết và thu hẹp nó đối với mỗi từ tiếp theo cho đến khi nó khớp với tất cả.
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. · Hoàn thành longestCommonPrefix(String[] strs) trả về tiền tố dài nhất được chia sẻ bởi mọi chuỗi. Trả về chuỗi rỗng nếu không có hoặc mảng rỗng.
Click Run to see the output here. · Nhấn Chạy để xem kết quả ở đây.