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 小时
- 30 天内合并 PR
- 187
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 天内回复