Why the "runtime error" is returned to me, but no problem when i run the code at G++4.4.5

  • 0
    int firstMissingPositive(int A[], int n) {
        for (int i=0;i<n;i++)
        for (int i=0;i<n;i++){
            A[i]>0?(A[A[i]-1]>0?(A[A[i]-1] *= (-1)):(true)):(A[(-1*A[i])-1]>0?(A[(-1*A[i])-1] *= (-1)):(true));
        for (int i=0;i<n;i++)
                return i+1;
        return n+1;

    Last executed input: [1,4,2,0,3,4,2,4,2]

Log in to reply

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