What suppose to be the output of input {}


  • 0
    Y

    I'm lost by the input {}, what does it mean? null or anything else?

    My code is like this at the very beginning

    if (head == null || head.next == null || n == 0)
         return head;
    

    but the Submission Result: Runtime Error

    Last executed input: {}, 0

    Can anyone help me on this?

    Thanks!


  • 0
    S

    I tried submit code like this, it turns out to be Wrong Answer.

    public class Solution {
        public ListNode rotateRight(ListNode head, int n) {
            // IMPORTANT: Please reset any member data you declared, as
            // the same Solution instance will be reused for each test case.
            if (head == null || head.next == null || n == 0)
                return head;
            return head;
        }
    }
    

    Sometimes, the last executed input is not accurate, especially when the result is Runtime Error. I would say there might be some bug elsewhere, not this edge check.


Log in to reply
 

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