leetcode

package
v0.0.0-...-f750034 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

  • @Author: Jerry You

  • @CreatedDate: 2022/11/5

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/11/5 18:26

  • @Author: Jerry You

  • @CreatedDate: 2021/9/5

  • @Last Modified by: lolaliva

  • @Last Modified time: 2021/9/5 3:48 PM

  • @Author: Jerry You

  • @CreatedDate: 2022/9/4

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/4 14:27

  • @Author: Jerry You

  • @CreatedDate: 2022/9/9

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/9 21:15

  • @Author: Jerry You

  • @CreatedDate: 2022/9/12

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/12 19:19

  • @Author: Jerry You

  • @CreatedDate: 2022/9/17

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/17 22:31

  • @Author: Jerry You

  • @CreatedDate: 2022/9/24

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/24 20:49

  • @Author: Jerry You

  • @CreatedDate: 2022/9/17

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/17 22:39

  • @Author: Jerry You

  • @CreatedDate: 2021/9/4

  • @Last Modified by: lolaliva

  • @Last Modified time: 2021/9/4 10:03 PM

  • @Author: Jerry You

  • @CreatedDate: 2021/9/5

  • @Last Modified by: lolaliva

  • @Last Modified time: 2021/9/5 11:43 AM

  • @Author: Jerry You

  • @CreatedDate: 2021/9/5

  • @Last Modified by: lolaliva

  • @Last Modified time: 2021/9/5 12:01 PM

  • @Author: Jerry You

  • @CreatedDate: 2022/9/3

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/3 17:00

  • @Author: Jerry You

  • @CreatedDate: 2022/8/28

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/8/28 18:22

  • @Author: Jerry You

  • @CreatedDate: 2022/9/10

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/10 22:33

  • @Author: Jerry You

  • @CreatedDate: 2022/9/15

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/15 20:56

Package leetcode /*

  • @Author: Jerry You

  • @CreatedDate: 2022/9/25

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/25 09:14

  • @Author: Jerry You

  • @CreatedDate: 2022/8/28

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/8/28 18:44

  • @Author: Jerry You

  • @CreatedDate: 2022/10/10

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/10/10 19:02

  • @Author: Jerry You

  • @CreatedDate: 2022/9/18

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/18 18:36

  • @Author: Jerry You

  • @CreatedDate: 2022/9/11

  • @Last Modified by: lolaliva

  • @Last Modified time: 2022/9/11 22:11

Package leetcode training from: https://www.codewars.com/kata/52a382ee44408cea2500074c/train/go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPermutation

func CheckPermutation(s1 string, s2 string) bool

CheckPermutation leetcode submit region begin(Prohibit modification and deletion) 方法一: 哈希表 直接统计s1和s2中每个字符的个数,然后比较每个字符的出现次数是否相等 为了减少内存的使用,可以只用一个map来比较

func CheckPermutation_2

func CheckPermutation_2(s1 string, s2 string) bool

CheckPermutation_2 方法二: 排序 将s1和s2排序后,然后依次比较每一位是否相同

func Determinant

func Determinant(matrix [][]int) int

Determinant

a b c d e f g h i j k l m n o p

func Entry

func Entry()

func HasCycle

func HasCycle(head *ListNode) bool

双指针法 慢指针: 每次往前走一步 快指针: 每次往前走两步

func P

func P(students []int, sandwiches []int) int

leetcode submit region begin(Prohibit modification and deletion) P 入口

func TODO

func TODO() int

func ThreeSum

func ThreeSum(nums []int) [][]int

Types

type Item

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

type Item901

type Item901 struct {
	// 当天是第几天
	Index int
	// 当天对应的price
	Price int
}

type ItemSorter

type ItemSorter []Item

func (ItemSorter) Len

func (s ItemSorter) Len() int

func (ItemSorter) Less

func (s ItemSorter) Less(i, j int) bool

func (ItemSorter) Swap

func (s ItemSorter) Swap(i, j int)

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

ListNode 链表

func Reverse

func Reverse(headNode *ListNode) *ListNode

Reverse reverse linked list

type MaxHeap

type MaxHeap struct {
	Profits []int
}

func (*MaxHeap) Len

func (h *MaxHeap) Len() int

func (*MaxHeap) Less

func (h *MaxHeap) Less(i, j int) bool

func (*MaxHeap) Pop

func (h *MaxHeap) Pop() interface{}

func (*MaxHeap) Push

func (h *MaxHeap) Push(x interface{})

func (*MaxHeap) Swap

func (h *MaxHeap) Swap(i, j int)

type MyLinkedList

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

leetcode submit region begin(Prohibit modification and deletion)

func Constructor

func Constructor() MyLinkedList

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
	Children []*Node
}

type StockSpanner

type StockSpanner struct {

	// 下一天是第几天
	NextIndex int
	// contains filtered or unexported fields
}

func Constructor901

func Constructor901() StockSpanner

func (*StockSpanner) Next

func (this *StockSpanner) Next(price int) int

type TreeNode

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

TreeNode 树

type Work

type Work struct {
	S int
	E int
	P int
}

leetcode submit region begin(Prohibit modification and deletion)

Source Files

Jump to

Keyboard shortcuts

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