Shortest possible C++ solution


  • 0
    Y

    It's maybe cheating, but std::unique just created for that )

    int removeDuplicates(int A[], int n) {
        return std::unique( A, A+n ) - A;    
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.