Metric Namespace Root judge accepts solutions that ignore middle strings

オープン
#863 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@explosion3975 がすでに取り組んでいます。

2026年11月26日 から。

  • #866 @explosion3975 による — オープン

評価

この issue はまだ評価されていません。

説明

Observed behavior

The five built-in cases for Metric Namespace Root (longest-common-prefix, LeetCode 14) all accept a solution that compares only the first and last strings in the input array. It never examines the strings between them.

def sharedLeadingText(strs):
    first, last = strs[0], strs[-1]
    i = 0
    while i < min(len(first), len(last)) and first[i] == last[i]:
        i += 1
    return first[:i]
Expected behavior

The judge should reject a solution that ignores a middle string. The contract requires the returned prefix to be shared by every string.

Proposed fix

Add ["flower", "dog", "flow"] with expected output "" as a built-in case. Append it after the existing cases so the variant's example reference keeps pointing to the same case.

Could you assign this issue to me?

主要言語
Rust
スター
236
フォーク
153
平均マージ
1日 9時間
マージ済み PR(30日)
187

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sysprog21/codetrial のほかの issue

sysprog21/codetrial の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。