Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/EndlessCheng/codeforces-go
/ functions
Functions
8,098 in github.com/EndlessCheng/codeforces-go
⨍
Functions
8,098
◇
Types & classes
911
Function
makeGood
github.com/EndlessCheng/codeforces-go
leetcode/weekly/201/a/a.go:4
Function
makeStringSorted
(s string)
leetcode/biweekly/50/d/d.go:19
Method
manhattanMST
曼哈顿距离最小生成树 O(nlogn) LC1584 https://leetcode-cn.com/problems/min-cost-to-connect-all-points/ 做法见官方题解 https://leetcode-cn.com/problems/min-cost-to-conne
copypasta/graph.go:1859
Function
mapPos
b 是 a 的一个排列(允许有重复元素) 返回 b 中各个元素在 a 中的下标(重复的元素顺序保持一致) 可用于求从 a 变到 b 需要的相邻位元素交换的最小次数,即返回结果的逆序对个数 LC1850/周赛239C https://leetcode-cn.com/problems/minimum-a
copypasta/misc.go:406
Function
matrixBlockSum
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/17/b/b.go:4
Function
matrixRankTransform
github.com/EndlessCheng/codeforces-go
leetcode/weekly/212/d/d.go:6
Method
max
()
copypasta/bst.go:280
Function
maxAbsValExpr
(a1 []int, a2 []int)
leetcode/weekly/146/d/d.go:3
Function
maxAlternatingSum
* 定义 $f[i][0]$ 表示前 $i$ 个数中长为偶数的子序列的最大交替和,$f[i][1]$ 表示前 $i$ 个数中长为奇数的子序列的最大交替和。 初始时有 $f[0][0] = 0$,$f[0][1] = -\infty$。 对于第 $i$ 个数,有选或不选两种决策。 对于 $f[
leetcode/biweekly/55/c/c.go:38
Function
maxArea
(h int, w int, a []int, b []int)
leetcode/weekly/191/b/b.go:5
Function
maxAscendingSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/233/a/a.go:6
Function
maxAverageRatio
(classes [][]int, ex int)
leetcode/weekly/232/c/c.go:17
Method
maxBipartiteMatchingHopcroftKarp
二分图最大匹配 - Hopcroft–Karp 算法 O(m√n) https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm https://algs4.cs.princeton.edu/code/edu/princeton/cs/
copypasta/graph.go:2351
Method
maxBipartiteMatchingHungarian
* 匹配 带权匹配 独立集 边覆盖 顶点覆盖 路径覆盖 支配集 https://en.wikipedia.org/wiki/Matching_(graph_theory) https://en.wikipedia.org/wiki/Maximum_weight_matching https://en
copypasta/graph.go:2286
Method
maxBipartiteMatchingHungarianLR
匈牙利算法的另一种写法,适用左右两侧节点有明确区分的情况,要求 g 中存储的是左侧到右侧的单向边
copypasta/graph.go:2316
Function
maxBuilding
github.com/EndlessCheng/codeforces-go
leetcode/weekly/238/d/d.go:6
Function
maxCandies
(status []int, candies []int, keys [][]int, containedBoxes [][]int, initialBoxes []int)
leetcode/weekly/168/d/d.go:3
Function
maxCoins
github.com/EndlessCheng/codeforces-go
leetcode/weekly/203/b/b.go:6
Function
maxCompatibilitySum
(students [][]int, mentors [][]int)
leetcode/weekly/251/c/c.go:73
Function
maxConsecutiveAnswers
同 1004. 最大连续1的个数 III https://leetcode-cn.com/problems/max-consecutive-ones-iii/ github.com/EndlessCheng/codeforces-go
leetcode/biweekly/62/c/c.go:6
Function
maxCoveredPoints
求一固定半径的圆最多能覆盖多少个点(圆边上也算覆盖) len(ps)>0 && r>0 Angular Sweep 算法 O(n^2logn) https://www.geeksforgeeks.org/angular-sweep-maximum-points-can-enclosed-circle
copypasta/geometry.go:637
Function
maxDepth
github.com/EndlessCheng/codeforces-go
leetcode/weekly/210/a/a.go:4
Function
maxDiff
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/25/b/b.go:10
Function
maxDistance
github.com/EndlessCheng/codeforces-go
leetcode/weekly/202/c/c.go:6
Function
maxDistance
* O(n) 做法 先判断最左右的两栋房子颜色是否相同,若不同直接返回 $n-1$。 若相同,则可以在其余位置(尽量靠近左或右)找到颜色不同于最左右房子颜色的房子,计算其到左右的最远距离,即为答案。 */ github.com/EndlessCheng/codeforces-go
leetcode/weekly/268/a/a.go:11
Function
maxDistance
github.com/EndlessCheng/codeforces-go
leetcode/weekly/240/b/b.go:6
Function
maxDistance
(grid [][]int)
leetcode/weekly/150/c/c.go:3
Function
maxDotProduct
(a, b []int)
leetcode/weekly/190/d/d.go:3
Function
maxEqualFreq
github.com/EndlessCheng/codeforces-go
leetcode/weekly/158/d/d.go:6
Function
maxEqualFreq2
(a []int)
leetcode/weekly/158/d/d.go:22
Function
maxEqualRowsAfterFlips
(mat [][]int)
leetcode/weekly/139/b/b.go:50
Function
maxEqualRowsAfterFlips_N3
(mat [][]int)
leetcode/weekly/139/b/b.go:3
Function
maxEvents
(a [][]int)
leetcode/weekly/176/c/c.go:5
Method
maxFlowDinic
圆方树 todo https://www.luogu.com.cn/blog/PinkRabbit/Introduction-to-Round-Square-Tree * 网络流·总结·题单 ######################################################
copypasta/graph.go:3203
Method
maxFlowHLPP
(in io.Reader, n, m, st, end int)
copypasta/graph.go:3469
Method
maxFlowISAP
ISAP, Improved Shortest Augmenting Path O(n^2 * m) https://oi-wiki.org/graph/flow/max-flow/#isap https://www.renfei.org/blog/isap.html 测试了一下性能和 Dinic
copypasta/graph.go:3353
Function
maxFreq
(ss string, maxLetters int, minSize int, maxSize int)
leetcode/weekly/168/c/c.go:42
Function
maxFrequency
github.com/EndlessCheng/codeforces-go
leetcode/weekly/238/b/b.go:6
Function
maxGeneticDifference
(parents []int, queries [][]int)
leetcode/weekly/250/d/d.go:50
Function
maxHeight
(a [][]int)
leetcode/weekly/219/d/d.go:8
Function
maxIceCream
github.com/EndlessCheng/codeforces-go
leetcode/weekly/237/b/b.go:6
Function
maxJumps
(a []int, d int)
leetcode/weekly/174/d_nlogn.go:60
Function
maxJumps
注:可以用单调队列 DP 优化到 O(n) https://leetcode-cn.com/circle/article/W7083y/
leetcode/weekly/174/d/d.go:5
Function
maxLength
(arr []string)
leetcode/weekly/160/c/c.go:41
Function
maxLengthBetweenEqualCharacters
github.com/EndlessCheng/codeforces-go
leetcode/weekly/211/a/a.go:6
Function
maxLengthBetweenEqualCharacters2
(s string)
leetcode/weekly/211/a/a.go:24
Function
maxLevelSum
(root *TreeNode)
leetcode/weekly/150/b/b.go:9
Function
maxMatrixSum
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/59/b/b.go:4
Function
maxNiceDivisors
(n int)
leetcode/weekly/234/d/d.go:6
Function
maxNonOverlapping
github.com/EndlessCheng/codeforces-go
leetcode/weekly/201/c/c.go:4
Function
maxNumEdgesToRemove
github.com/EndlessCheng/codeforces-go
leetcode/weekly/205/d/d.go:39
Function
maxNumOfSubstrings
github.com/EndlessCheng/codeforces-go
leetcode/weekly/198/c/c.go:6
Function
maxNumber
(nums1, nums2 []int, k int)
leetcode/main.go:1119
Function
maxNumberOfApples
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/9/a/a.go:6
Function
maxNumberOfFamilies
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/22/b/b.go:4
Function
maxOperations
github.com/EndlessCheng/codeforces-go
leetcode/weekly/218/b/b.go:4
Function
maxPathSum
LC 124
leetcode/main.go:574
Function
maxPerformance
(n int, speed []int, efficiency []int, k int)
leetcode/weekly/180/d_pq.go:17
Function
maxPerformance
(n int, speed, efficiency []int, k int)
leetcode/weekly/180/d/d.go:100
Function
maxPoints
* DP 优化技巧:拆项+前后缀最大值 本文用 $n$ 表示行数,$m$ 表示列数。 定义 $f[i][j]$ 表示前 $i$ 行中,第 $i$ 行选择 $\textit{points}[i][j]$ 时的最大得分,则有 $$ f[i][j] = \textit{points}[i][j] +
leetcode/weekly/250/c/c.go:42
Function
maxPower
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/26/a/a.go:4
Function
maxProbability
(n int, edges [][]int, succProb []float64, st, end int)
leetcode/weekly/197/c/c.go:25
Function
maxProduct
LC 152
leetcode/main.go:863
Function
maxProduct
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/58/d/d.go:4
Function
maxProduct
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
leetcode/weekly/174/c/c.go:13
Function
maxProduct
Go 爆搜 github.com/EndlessCheng/codeforces-go
leetcode/weekly/258/c/c.go:6
Function
maxProduct
(a []int)
leetcode/weekly/191/a/a.go:3
Function
maxProductDifference
github.com/EndlessCheng/codeforces-go
leetcode/weekly/247/a/a.go:6
Function
maxProductPath
github.com/EndlessCheng/codeforces-go
leetcode/weekly/207/c/c.go:4
Function
maxProfit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/214/c/c.go:6
Function
maxProfitMaxTwice
LC 123
leetcode/main.go:555
Function
maxRepeating
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/40/a/a.go:6
Function
maxResult
(a []int, k int)
leetcode/weekly/220/c/c.go:31
Function
maxSatisfaction
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/23/d/d.go:6
Function
maxScore
(s string)
leetcode/weekly/186/a/a.go:5
Function
maxScore
(a []int, k int)
leetcode/weekly/186/b/b.go:3
Function
maxScoreWords
(words []string, letters []byte, score []int)
leetcode/weekly/162/d/d.go:3
Function
maxSideLength
(mat [][]int, threshold int)
leetcode/weekly/167/c/c.go:3
Function
maxSizeSlices
(A []int)
leetcode/biweekly/22/d/d.go:18
Function
maxSizeSlices2
O(n^2) 做法
leetcode/biweekly/22/d/d.go:50
Function
maxStudents
(mat [][]byte)
leetcode/weekly/175/d/d.go:3
Function
maxSubsequence
两次排序 github.com/EndlessCheng/codeforces-go
leetcode/biweekly/67/a/a.go:8
Function
maxSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/200/d/d.go:4
Function
maxSumBST
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/21/d/d.go:6
Function
maxSumBST2
这种写法是错误的,见 [9,4,10,null,null,6,11] => 27
leetcode/biweekly/21/d/d.go:36
Function
maxSumDivThree
(nums []int)
leetcode/weekly/163/main.go:82
Function
maxSumDivThree
(nums []int)
leetcode/weekly/163/c/c.go:5
Function
maxSumMinProduct
github.com/EndlessCheng/codeforces-go
leetcode/weekly/240/c/c.go:4
Function
maxSumRangeQuery
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/35/b/b.go:6
Function
maxSumTwoNoOverlap
github.com/EndlessCheng/codeforces-go
leetcode/weekly/133/c/c.go:4
Function
maxTaskAssign
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/65/d/d.go:6
Function
maxTaxiEarnings
* 动态规划 定义 $f[i]$ 表示行驶到 i 时的最大盈利。考虑状态转移,一方面,我们可以不接终点为 $i$ 的乘客,这样有 $f[i]=f[i-1]$;另一方面,我们可以接所有终点为 $i$ 的乘客,这样有 $f[i] = \max f[start]+end-start+tip$,二者取最大
leetcode/biweekly/61/c/c.go:12
Function
maxTotalFruits
github.com/EndlessCheng/codeforces-go
leetcode/weekly/271/d/d.go:6
Function
maxTwoEvents
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/64/b/b.go:9
Function
maxUniqueSplit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/207/b/b.go:4
Function
maxValue
github.com/EndlessCheng/codeforces-go
leetcode/weekly/243/b/b.go:4
Function
maxValue
(n, i, maxSum int)
leetcode/weekly/233/c/c.go:16
Function
maxValueAfterReverse
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/18/d/d.go:4
Function
maxVowels
我的憨憨写法
leetcode/weekly/190/b/b.go:6
Function
maxVowels2
优雅的写法:前缀和
leetcode/weekly/190/b/b.go:37
← previous
next →
7,301–7,400 of 8,098, ranked by callers