Skip to content

Bug Report for find-duplicate-integer #5426

@amiraslanaslani

Description

@amiraslanaslani

Bug Report for https://neetcode.io/problems/find-duplicate-integer

In the provided solution based on bit manipulation, there is a wrong assumption:

Every number from 1 to n−1 should appear exactly once, but in the array, one number appears twice

Some of the numbers from 1 to n-1 appear exactly once, except one number that appears more than once (it could appear more than two times). If that number appears only twice, then every number from 1 to n-1 appear exactly once except that one. However, if that number appears more than twice, there must be at least one missing number from 1 to n−1.

The provided solution is correct under that assumption, but the assumption itself is wrong for this question, and it causes the provided solution to be incorrect.

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