Is Subsequence judge accepts frequency-only solutions that ignore character order
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
Problem
The is-subsequence judge does not currently test whether a solution preserves the relative order of characters.
As a result, an incorrect frequency-count implementation passes all five existing judge cases, even though it does not satisfy the problem statement.
Steps to Reproduce
The judge is defined in problem-bank/judges.json under is-subsequence.
I compared two implementations against the existing five cases:
Incorrect implementation: Counts character frequencies in
tand checks whether all characters ofsare available, ignoring order.Correct implementation: Uses two pointers to match the characters of
sin their original order withint.
Both implementations passed all five existing cases.
| Implementation | Existing cases passed |
|---|---|
| Frequency-count implementation (incorrect) | 5/5 |
| Two-pointer implementation (correct) | 5/5 |
Minimal Counterexample
s = "ab"
t = "ba"Expected result: false
Actual result from the incorrect frequency-count implementation: true
Both characters exist in t, but they appear in the wrong order. Therefore, s is not a subsequence of t.
The correct two-pointer implementation returns false.
Proposed Fix
Add an order-sensitive case to the is-subsequence judge:
{
"label": "reversed character order",
"input": ["ab", "ba"],
"expected": false
}This test rejects the frequency-count implementation while allowing the correct two-pointer implementation.
Verification
I reproduced the issue locally using the actual five cases loaded from problem-bank/judges.json.
Results:
Incorrect frequency-count solution: 5/5 existing cases passed.
Correct two-pointer solution: 5/5 existing cases passed.
Proposed reversed-order case: incorrect solution failed; correct solution passed.
The local reproduction directly compared outputs against the JSON judge cases. It did not execute the full browser runner.
No production-code changes are needed.
- 主要言語
- Rust
- スター
- 236
- フォーク
- 153
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 187
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sysprog21/codetrial のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
Unify Java harness validation error messages対応中かも @weichieh0204 が今日担当しました。 オープン
sysprog21/codetrial#872 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Inferred void class operations are never checked against the starter's return type対応中かも @papaya0112 が今日担当しました。 オープン
sysprog21/codetrial#871 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Edge Thumbnail Store accepts a store that does not refresh a key on overwrite対応中かも @BOBOGUAGUA428 が今日担当しました。 オープン
sysprog21/codetrial#869 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
sysprog21/codetrial の issue をすべて見る
似ている issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
manaflow-ai/cmux#59692 ·
メンテナーはふだん 1 日以内に返信
-
Retire stale Python-parity labels in Rust ingress and auth tests対応中かも @github-actions が今日担当しました。 オープンfactory factory:building factory:unowned ralph-status:in-progress via:opencode-free/hy4-flash-free
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
JoshCLWren/comic-pile#5874 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
status:ready unit
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nonagenticai/conveyor#787 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信