Copy-with-random tests accept a copied list that loops back into itself
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Observed behavior
In Outline Snapshot Duplicator question,a deep copy whose last node links back to the first copy passes 5/5 in C++, same as a correct solution.
Expected behavior
A returned copy that reaches a node twice fails with the message the plain list serializers now use, "Returned list must not reach a node twice."A correct copy still passes 5/5, and "empty random list" is unaffected.
Reproduction
- Open Outline Snapshot Duplicator and select C++.
- Paste the solution below and run tests. All 5 cases pass.
- Change
copies[head]on the marked line tonullptr(the correct solution) and run tests again. All 5 cases pass.
class Solution {
public:
Node* snapshotOutline(Node* head) {
if (!head) return nullptr;
unordered_map<Node*, Node*> copies;
for (Node* p = head; p; p = p->next) copies[p] = new Node(p->val);
for (Node* p = head; p; p = p->next) {
copies[p]->next = p->next ? copies[p->next] : copies[head]; // should be nullptr
copies[p]->random = p->random ? copies[p->random] : nullptr;
}
return copies[head];
}
};
CodeTrial version
My Windows binary (codetrial-x86_64-pc-windows-msvc.exe) does not accept --version: it answers "--version requires a value". File times: created 2026-09-17 10:05 and last modified 2026-10-15 12:53 (UTC+8). The same serializer code is still on main at 6756678.
Environment
OS: Windows 11
Browser: Chrome
Language: C++
Interview loop: Coding
Problem: Outline Snapshot Duplicator
REACTO or STAR step: Test
Reconnect: None
Sanitized evidence
No response
Public data confirmation
- I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.
- 主要语言
- Rust
- 星标
- 177
- 派生
- 100
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 168
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Python tests lose every result when the solution returns inf or NaN可能已有人在做 @shensyuan 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
sysprog21/codetrial#419 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Allow deselecting a chosen problem card by clicking it again可能已有人在做 @woohsin 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
sysprog21/codetrial#392 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Audio output can be confirmed without playing a test sound可能已有人在做 @ChenYingHan1121 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
sysprog21/codetrial#359 · 5 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Add a Copy code button to the final report可能已有人在做 @yansawu 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
sysprog21/codetrial#318 · 5 条评论 · 2 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
pedrovgs/UseCaseCoverage#23 ·
-
priority: low
难度 2/5 1-3 小时 新手友好度 64/100
storytold/photocraft#8687 · 1 条评论 ·
维护者通常 2 天内回复
-
area:kernel bug kernel-paused needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
bherbruck/solvecraft#5055 · 2 条评论 ·
-
bug cli p3
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 3 天内回复
-
documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复