Leetcode c runtime error

  • 0

    This is the code that I wrote, i ran it locally with std=c99 and std=c11, both are fine, but in leetcode there's a runtime error. Any help is appreciated, thanks.

    void moveZeros(int* nums, int numSize) {
        int* iterator = nums + numSize;
        int* pivot;
        while (!*iterator) iterator--;
        pivot = iterator;
        while (iterator > nums) {
            while (*iterator && (iterator > nums)) iterator--;
            if (!*iterator) move_fwd(iterator, &pivot);
    void move_fwd(int* iterator, int** pivot) {
        for (; iterator < *pivot; iterator++) {
            *iterator = *(iterator+1);
        **pivot = 0;

Log in to reply

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