Shared Buffer Keystroke Audit accepts a second-source-first greedy merge
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
Observed behavior
The five built-in interleaving-string cases (variant: Shared Buffer Keystroke Audit) only ever defeat a greedy, no-backtracking merge that takes the next matching character from s1 before s2. A solution that always takes the next match from s2 before s1, with no backtracking, passes every one of them, even though it is just as unsound as the s1-first greedy.
Expected behavior
The judge should reject a solution that cannot actually produce a correct interleaving check, regardless of which source string the implementation happens to prefer.
Reproduction
- At the current source revision, read
problem-bank/judges.json'sinterleaving-stringentry:weaves into buffer,buffer cannot match logs,all empty,length mismatch,shared letters. - Implement
isInterleave(s1, s2, s3)as: walks3; at each character, if the next unused character ofs2matches, consume it froms2; else if the next unused character ofs1matches, consume it froms1; else return false. Return true only once both sources are exhausted. - Run that implementation against the five cases above. It returns the expected value for all five.
- Run it on
s1="ab",s2="a",s3="aba". It returnsfalse. The correct answer istrue:s1followed bys2spellss3exactly ("ab" + "a" = "aba"), but the solution in step 2 greedily consumess2's only"a"at position 0, leaving nothing ins2to match the trailing"a"onces1is exhausted.
CodeTrial version
Not run here: this environment's Xcode Command Line Tools cannot build the LiveKit WebRTC native dependency, so cargo run -- --version does not build. The check above is against problem-bank/judges.json at upstream main 925db68f, read directly and evaluated independently in Python; nothing else in that file changed.
Environment
OS: n/a (judge-data defect, reproduces from the bank data alone, independent of OS)
Browser: n/a
Language: Python, JavaScript, C, C++, Java (the five built-in cases are checked by exact value match, so the gap applies the same way in every supported language)
Interview loop: task mode and live interview, Coding Exercise
Problem: interleaving-string (Shared Buffer Keystroke Audit)
REACTO or STAR step: Run tests / grading
Reconnect: none
Sanitized evidence
label input expected s2-first greedy
weaves into buffer ["aabcc","dbbca","aadbbcbcac"] true true
buffer cannot match logs ["aabcc","dbbca","aadbbbaccc"] false false
all empty ["","",""] true true
length mismatch ["a","b","a"] false false
shared letters ["aa","ab","aaba"] true true
(not a built-in case) ["ab","a","aba"] true false <- wrong
- I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.
Evidence and proposed fix
I checked open and closed issues and open pull requests for "interleaving", "Shared Buffer Keystroke Audit", and the problem id; none exist. The gap is symmetric to the one #856 names for judge bounds (one direction checked, the mirrored one not): here the five cases were all reachable by favoring s1, none by favoring s2.
A minimal fix adds two cases to problem-bank/judges.json's interleaving-string entry that are reachable only when the earlier source is taken first rather than the later one:
s1="ab", s2="a", s3="aba"->true(the minimal counterexample above)s1="ab", s2="aa", s3="aaba"->true(the s2-first greedy consumes both of s2's characters before it gets stuck, so this rules out a shallow one-character-lookahead patch)
Alongside the new cases, a regression test in tests/browser/compiler-explorer.test.js should pin the s2-first greedy to each new case by label, matching the pattern already used for jump-game, word-pattern and the other recent judge-case fixes, so dropping or editing either case fails that test. python3 scripts/gen-problems.py then regenerates web/judges/shared-buffer-keystroke-audit.json, and tests/golden/task-posed.json's hash for interleaving-string needs recomputing to match.
I have this fix ready, validated against node --test tests/browser/compiler-explorer.test.js (150 passed) and python3 scripts/run-python-tests.py tests/test_task_package.py (38 passed, including the recomputed golden hash); cargo test could not run in this environment for the reason given above, so the Rust-side mirror of the same golden hash in tests/unit/tasks/exercise.rs is unverified locally and will need CI. Please assign this issue to me (@sakinu) if the scope looks right.
- 主要言語
- 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
-
marketing
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
eliasstravik/herdr-projects#1605 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
jlcodes99/cockpit-tools#3332 ·
メンテナーはふだん 3 日以内に返信
-
Cognito: the email MFA code (EMAIL_OTP challenge after a password flow) has 8 digits; AWS delivers 6オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/aws-emulator#692 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信