Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Copy-with-random tests accept a copied list that loops back into itself

未关闭
#417 4 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@papaya0112 已经在做这个了。

开始于 2026年10月21日。

  • #430 来自 @papaya0112 —— 未关闭

评估

这个 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
  1. Open Outline Snapshot Duplicator and select C++.
  2. Paste the solution below and run tests. All 5 cases pass.
  3. Change copies[head] on the marked line to nullptr (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];
    }
};
Image Image
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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sysprog21/codetrial 的其他 Issue

查看 sysprog21/codetrial 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。