Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPalindrome ¶
没想到什么好的办法,先把链表的节点存入一个 slice,然后双指针从 slice 两头向中间遍历,遇到不同则返回 false,效率很差
Types ¶
type ListNode ¶
func ReverseKGroup ¶
func ReverseList ¶
注意修改指针指向的值是否会影响到其他变量, 所以需要一个 prev 保存之前的指针,一个 next 保存当前指针的 Next
func ReverseListV2 ¶
对于 ... -> k -> k+1 -> ... ->m 反转 k 的时候,假设 k+1~m 已经反转,则需要把 k+1 的 next 指向 m,k 的 next 指向 nil
Source Files
¶
- 141.linked-list-cycle.go
- 141.reverse-linked-list.go
- 142.linked-list-cycle-ii.go
- 148.sort-list.go
- 160.intersection-of-two-linked-lists.go
- 19.remove-nth-node-from-end-of-list.go
- 21.merge-two-sorted-lists.go
- 23.merge-k-sorted-lists.go
- 234.palindrome-linked-list.go
- 237.delete-node-in-a-linked-list.go
- 25.reverse-nodes-in-k-group.go
- list.go
- offer.06.cong-wei-dao-tou-da-yin-lian-biao-lcof.go
Click to show internal directories.
Click to hide internal directories.