LinkedList
Nahida_nora
这个作者很懒,什么都没留下…
展开
-
Leetcode 725. Split Linked List in Parts
Leetcode 725. Split Linked List in Parts If there are N nodes in the linked list root, then there are N / k items in each part, plus the first N%k parts have an extra item. 有N个节点,前N%k个部分有 (N/k + N%k )个数字,其余有N/k。 Approach #1: Create New Lists [Accepted] cl原创 2020-06-22 06:16:56 · 110 阅读 · 1 评论 -
Leetcode 369. Plus One Linked List
Leetcode 369. Plus One Linked List Sentinel node 可能遇到: head 是9的情况, head == 9->9->9, 所以需要引入sentinel node, 0 (sentinel) -> 9 -> 9 -> 9, 然后发现最右边第一个不为9的节点,就是sentinel node, 1 -> 0 -> 0 ->0, return sentinel head 不是9的情况, 8 -> 9 -&原创 2020-06-22 02:08:28 · 107 阅读 · 0 评论