You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a few minor issues in the code ig , Because the code throws some error while submitting on leetcode
I have written a code that works fine and follows the same approach as shown in the video
class Solution {
public ListNode sortList(ListNode head) {
if (head == null || head.next == null) {
return head;
}
// Find the middle of the list
ListNode mid = getMid(head);
ListNode left = sortList(head);
ListNode right = sortList(mid);
return merge(left, right);
}
There are a few minor issues in the code ig , Because the code throws some error while submitting on leetcode
I have written a code that works fine and follows the same approach as shown in the video
class Solution {
public ListNode sortList(ListNode head) {
if (head == null || head.next == null) {
return head;
}
// Find the middle of the list
ListNode mid = getMid(head);
ListNode left = sortList(head);
ListNode right = sortList(mid);
return merge(left, right);
}
}
The text was updated successfully, but these errors were encountered: