Very very troubling test case InterviewBit ;-; (read till end)

int Solution::removeDuplicates(vector<int> &A) {
    int i = 0, j = 1, N = A.size();
    if(N == 1) return A[0];
    while(i < N-1 && j < N){
        if(A[j] == A[i]){
        else {
            i = j;
    A.erase(A.begin(), A.begin()+N);
    return A.size();


Hey guys! Do run this code and check. Take any custom test case and run it first. It will work BEAUTIFULLY. Now run the testcase of IB. It will say wrong and and give this test case : [ 0 ].
Now, that the heck is this test case?! What are those spaces around 0? I’m so pissed off right now :face_with_head_bandage:
If anyone can figure out why I’m wrong, I’ll be in your debt. Thanks


because you have put initial condition wrong
If(N==1) return 1;


Yep, that was it! Thank you! :slight_smile: