Skip to content

Bug Report for contains-duplicate-ii #4216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MichalMarciniakGS opened this issue Jun 2, 2025 · 1 comment
Closed

Bug Report for contains-duplicate-ii #4216

MichalMarciniakGS opened this issue Jun 2, 2025 · 1 comment

Comments

@MichalMarciniakGS
Copy link

Bug Report for https://neetcode.io/problems/contains-duplicate-ii

When I try to Run/Submit solution (as below) in C++ issue occurs. For simple Run, only bottom Console Output comes out but it is totally empty (screenshot 1).
For Submit, I receive 'Unknown' response in Submissions tab (screenshot 2).

On leetcode website, the same exact code works and passes all the tests. I am attaching code and leetcode pass prove (screenshot 3)

Screenshot 1:

Image

Screenshot 2:

Image

Screenshot 3:

Image

Code:

 class Solution {
 public:

    bool containsNearbyDuplicate(vector<int>& nums, int k) {

        int L = 0;
        unordered_set<int> window;

        for (int R = 0; R < nums.size(); R++) {

            if (window.count(nums[R])) {
                return true;
            }

            window.insert(nums[R]);

            if (window.size() > k) {
                window.erase(nums[L]);
                L++;
            }
        }
        return false;
    }
 };
@Srihari2222
Copy link
Collaborator

Thanks for the feedback! The issue is resolved in the backend and will soon resolved on the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants