Is Subsequence judge accepts frequency-only solutions that ignore character order
Mantenedores costumam responder em até 1 dia
Avaliação
Esta issue ainda não foi avaliada.
Descrição
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.
- Linguagem predominante
- Rust
- Estrelas
- 236
- Forks
- 153
- Merge médio
- 1d 9h
- PRs com merge (30d)
- 187
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de sysprog21/codetrial
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
Unify Java harness validation error messagesTalvez já em andamento @weichieh0204 assumiu hoje. Aberta
sysprog21/codetrial#872 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Inferred void class operations are never checked against the starter's return typeTalvez já em andamento @papaya0112 assumiu hoje. Aberta
sysprog21/codetrial#871 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Edge Thumbnail Store accepts a store that does not refresh a key on overwriteTalvez já em andamento @BOBOGUAGUA428 assumiu hoje. Aberta
sysprog21/codetrial#869 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de sysprog21/codetrial
Issues semelhantes
-
BUG: WebGPU finds no adapter on Linux when a DRM card has no vendor file (ONNX Runtime 1.24.4)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
CyberTimon/RapidRAW#2303 ·
Mantenedores costumam responder em até 1 dia
-
[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 pageTalvez já em andamento @YusufMntm assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
tauri-apps/tauri#16660 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
manaflow-ai/cmux#59692 ·
Mantenedores costumam responder em até 1 dia
-
Retire stale Python-parity labels in Rust ingress and auth testsTalvez já em andamento @github-actions assumiu hoje. Abertafactory factory:building factory:unowned ralph-status:in-progress via:opencode-free/hy4-flash-free
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
JoshCLWren/comic-pile#5874 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
status:ready unit
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
nonagenticai/conveyor#787 ·
Mantenedores costumam responder em até 1 dia