Documentation
¶
Overview ¶
https://leetcode.com/problems/add-two-numbers/#/description
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
给你两个表示两个非负数字的链表。数字以相反的顺序存储,其节点包含单个数字。将这两个数字相加并将其作为一个链表返回。
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 -> 8
https://leetcode.com/problems/add-two-numbers-ii/
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Follow up:
What if you cannot modify the input lists? In other words, reversing the lists is not allowed.
Example:
Input: (7 -> 2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 8 -> 0 -> 7 https://leetcode.com/problems/merge-two-sorted-lists/#/description
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MyLinkedList ¶
type MyLinkedList struct {
// contains filtered or unexported fields
}
func (*MyLinkedList) AddAtHead ¶
func (this *MyLinkedList) AddAtHead(val int)
func (*MyLinkedList) AddAtIndex ¶
func (this *MyLinkedList) AddAtIndex(index int, val int)
func (*MyLinkedList) AddAtTail ¶
func (this *MyLinkedList) AddAtTail(val int)
func (*MyLinkedList) DeleteAtIndex ¶
func (this *MyLinkedList) DeleteAtIndex(index int)
func (*MyLinkedList) Get ¶
func (this *MyLinkedList) Get(index int) int
Source Files
¶
- MyLinkedList.go
- addTwoNumbers.go
- addTwoNumbers2.go
- copyRandomList.go
- deleteDuplicates.go
- deleteDuplicates2.go
- deleteNode.go
- detectCycle.go
- getIntersectionNode.go
- hasCycle.go
- insertionSortList.go
- isPalindrome.go
- mergeKLists.go
- mergeTwoLists.go
- middleNode.go
- numComponents.go
- oddEvenList.go
- partition.go
- removeElements.go
- removeNthFromEnd.go
- reorderList.go
- reverseBetween.go
- reverseKGroup.go
- reverseList.go
- rotateRight.go
- sortList.go
- splitListToParts.go
- swapPairs.go