Skip to content · ⁨コンテンツへスキップ⁩

Longest common prefix · ⁨最長共通接頭辞⁩

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.

日本語

最長共通接頭辞

配列内のすべての単語を始める最長の文字列を返します。flower, flow, flightの場合、答えはflです。共通するものがなければ""を返します。最初の単語を推測として始め、次の単語ごとに縮めていき、全てに当てはまるまで進めます。

Log in or create account · ⁨ログインまたはアカウント作成⁩

IGCSE, A-Level & AP