deno.land / x / masx200_leetcode_test@10.6.5 / sort-list / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { ArrayToListNode } from "../reverse-linked-list/ArrayToListNode.ts";import { ListNode } from "../reverse-linked-list/ListNode.ts";import { ListNodeToArray } from "../reverse-linked-list/ListNodeToArray.ts";import sortArray from "../sort-an-array/index.ts";
function sortList(head: ListNode | null): ListNode | null { if (head === null) { return head; } if (head.next === null) { return head; } return ArrayToListNode(sortArray(ListNodeToArray(head)));}export default sortList;
masx200_leetcode_test

Version Info

Tagged at
a year ago