Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#417 コメント 4 件 リアクション 0 件 担当者 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時間
マージ済み PR(30日)
168

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sysprog21/codetrial のほかの issue

sysprog21/codetrial の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。