TLE for Python?
I have a Time Limit Exceeded when input a list of 5000 numbers.\n\n    class Solution:\n    # @param head, a ListNode\n    # @return a ListNode\n    def insertS
I have a Time Limit Exceeded when input a list of 5000 numbers.\n\n    class Solution:\n    # @param head, a ListNode\n    # @return a ListNode\n    def insertSort(self, head):\n        if head==None or head.next==None:\n            return head\n        self.insertSort(head.next)\n        l=head\n        r=head.next\n        while r!=None:\n            if l.val>r.val:\n                l.val,r.val=r.val,l.val\n                l=r\n                r=r.next\n            else:\n                return head\n        return head\n    def insertionSortList(self, head):\n        return self.insertSort(head)\nis there any solution for the problem?
['Python']