Skip to content

Incomplete C++ solution for Clone Graph passes test suite #6120

Description

@s-kunwar

Bug Report for https://neetcode.io/problems/clone-graph

Submitting an incomplete C++ solution that only contains a nullptr check for the empty graph case gets marked as Accepted and passes all 18 test cases.

Image

Here's the code to reproduce the bug:

class Solution {
public:
    Node* cloneGraph(Node* node) {
        if (node == nullptr) return nullptr;
    }
};

The submission should fail with a Wrong Answer, Segmentation Fault, or Runtime Error when evaluated against non-empty graph inputs. But the judge marks the submission as Accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions