OJ is buggy, it crashes even if i just return

  • 0

    Online judge is horrible broken and gives crashes for this one.
    I managed to simplify the issue to the bellow case.
    Now i fully know that this code is wrong, but it should never crash for the above case since
    for k = 0 rotate is just returning.

    Last executed input: [1,2], 0
    Submission Result: Runtime Error

    class Solution {
        void rotate(int nums[], int n, int k) 
            if (k == 0)
            k = n%k;
            int m = n-k;
            std::rotate( nums, nums+n, nums + m);

Log in to reply

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