lll

package
v0.0.0-...-d229d73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 1 Imported by: 0

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 ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

func (*ListNode) String

func (l *ListNode) String() string

type MyLinkedList

type MyLinkedList struct {
	// contains filtered or unexported fields
}

func Constructor

func Constructor() MyLinkedList

Constructor Initialize your data structure here.

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

type Node

type Node struct {
	Val    int
	Next   *Node
	Random *Node
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL