Please Note that :- Here the internal code will traverse from the start of the array to the length Your Return


In this question the length which you return, the internal code will traverse up to that length so you don’t have to explicitly remove the element from the vector.

For Better Understanding see My code.

int Solution::removeDuplicates(vector<int> &nums) {
    // Do not write main() function.
    // Do not read input, instead use the arguments to the function.
    // Do not print the output, instead return values as specified
    // Still have a doubt. Checkout for more details
    return 0;
    int prev=0;
    for(int i=1;i<nums.size();i++)
            // not same so aage badle chaka maro;
    return prev+1;

TLE at submission ! please someone point out the mistake