Last executed input:{}


  • 1
    W

    Hi folks,
    I received a runtime error : Last executed input: {}. what does this mean, and what is the desired output for this input in this problem?
    Thanks!


  • 7
    S

    Intput is {} means there is empty list.

    The output should be {} too.

    Since there is no element to sort. You may not handle this edge case in your code.


  • 0
    W

    thanks. But the default list defined in the problem is as follows:
    /**

    • Definition for singly-linked list.
    • class ListNode {
    • int val;
      
    • ListNode next;
      
    • ListNode(int x) {
      
    •     val = x;
      
    •     next = null;
      
    • }
      
    • }
      */
      I am not quite sure what an empty list is like. Is it just "null"?

  • 0
    S

    yes. just null


  • 0
    W

    thanks so much!
    I just tried and passed. Actually I considered about the null corner case. My code did have 2 flaws:

    1. Shouldn't include the declarision of the defined one-way linked-list again.
    2. Shouldn't include extra "prints".
      These caused the examination systems to refuse submission attempts.
      BTW, HEAPSORT works!

Log in to reply
 

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