_022_06

package
v0.0.0-...-9cdbae4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const N = 1000000007
View Source
const (
	N1 = 1000000010
)

Variables

This section is empty.

Functions

func DuplicateZeros

func DuplicateZeros(arr []int)

模拟栈

func FindAndReplacePattern

func FindAndReplacePattern(words []string, pattern string) []string

func FindFrequentTreeSum

func FindFrequentTreeSum(root *binaryTree.Node) []int

func FindPairs

func FindPairs(nums []int, k int) int

二分,排序

func FindSubstring

func FindSubstring(s string, words []string) []int

FindSubstring https://leetcode.cn/problems/substring-with-concatenation-of-all-words/

给定一个字符串s和一些长度相同的单词words 。找出 s 中恰好可以由words 中所有单词串联形成的子串的起始位置。

注意子串要与words中的单词完全匹配,中间不能有其他字符 ,但不需要考虑words中单词串联的顺序。

func Insert

func Insert(aNode *linkedList.ListNode, x int) *linkedList.ListNode

给定循环单调非递减列表中的一个点,写一个函数向这个列表中插入一个新元素 insertVal ,使这个列表仍然是循环升序的。

给定的可以是这个列表中任意一个顶点的指针,并不一定是这个列表中最小元素的指针。

如果有多个满足条件的插入位置,可以选择任意一个位置插入新的值,插入后整个列表仍然保持有序。

如果列表为空(给定的节点是 null),需要创建一个循环有序列表并返回这个节点。否则。请返回原先给定的节点。

func MinFlipsMonoIncr

func MinFlipsMonoIncr(s string) int

func MinFlipsMonoIncr2

func MinFlipsMonoIncr2(s string) int

lcs 和 lis

func MinFlipsMonoIncr3

func MinFlipsMonoIncr3(s string) int

前缀和

func NumPrimeArrangements

func NumPrimeArrangements(n int) int

func SmallestDistancePair

func SmallestDistancePair(nums []int, k int) int

TLE 简单写个堆排吧

func SmallestDistancePair2

func SmallestDistancePair2(nums []int, k int) int

func WiggleSort

func WiggleSort(nums []int)

Types

type Codec

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

func Constructor

func Constructor() Codec

type RangeModule

type RangeModule struct {
	Root *SegmentNode
}

func Constructor1

func Constructor1() RangeModule

func (*RangeModule) AddRange

func (node *RangeModule) AddRange(left int, right int)

func (*RangeModule) QueryRange

func (node *RangeModule) QueryRange(left int, right int) bool

func (*RangeModule) RemoveRange

func (node *RangeModule) RemoveRange(left int, right int)

type SegmentNode

type SegmentNode struct {
	Ls, Rs *SegmentNode
	// add 代表懒标记
	Add int
	// 代表要统计的值
	Val int
}

type Solution

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

https://leetcode.cn/problems/random-pick-with-blacklist/

func Constructor2

func Constructor2(n int, blacklist []int) Solution

func (*Solution) Pick

func (this *Solution) Pick() int

Directories

Path Synopsis
dp

Jump to

Keyboard shortcuts

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