Is Subsequence judge accepts frequency-only solutions that ignore character order
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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.
- Vorherrschende Sprache
- Rust
- Sterne
- 236
- Forks
- 153
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 187
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus sysprog21/codetrial
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Unify Java harness validation error messagesEvtl. vergeben @weichieh0204 hat das heute übernommen. Offen
sysprog21/codetrial#872 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Inferred void class operations are never checked against the starter's return typeEvtl. vergeben @papaya0112 hat das heute übernommen. Offen
sysprog21/codetrial#871 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Edge Thumbnail Store accepts a store that does not refresh a key on overwriteEvtl. vergeben @BOBOGUAGUA428 hat das heute übernommen. Offen
sysprog21/codetrial#869 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in sysprog21/codetrial
Ähnliche Issues
-
BUG: WebGPU finds no adapter on Linux when a DRM card has no vendor file (ONNX Runtime 1.24.4)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
CyberTimon/RapidRAW#2303 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[bug] NSIS installer reads its flags from $CMDLINE, so an unquoted forward-slash path (e.g. C:/Projects/...) triggers passive mode and skips the licence pageEvtl. vergeben @YusufMntm hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
tauri-apps/tauri#16660 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
manaflow-ai/cmux#59692 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Retire stale Python-parity labels in Rust ingress and auth testsEvtl. vergeben @github-actions hat das heute übernommen. Offenfactory factory:building factory:unowned ralph-status:in-progress via:opencode-free/hy4-flash-free
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
JoshCLWren/comic-pile#5874 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:ready unit
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
nonagenticai/conveyor#787 ·
Maintainer antworten meist innerhalb von 1 Tag