Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng
#417 4 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@papaya0112 đang làm issue này rồi.

Từ ngày 21/10/2026.

  • #430 của @papaya0112 — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.
Ngôn ngữ chính
Rust
Star
177
Fork
100
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
182

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sysprog21/codetrial

Tất cả issue của sysprog21/codetrial

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.