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
getMaximumGenerated
github.com/EndlessCheng/codeforces-go
leetcode/weekly/214/a/a.go:4
Function
getMaximumXor
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/50/c/c.go:4
Function
getMinDistSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/197/d/d.go:9
Function
getMinDistance
github.com/EndlessCheng/codeforces-go
leetcode/weekly/239/a/a.go:4
Function
getMinSwaps
(s string, k int)
leetcode/weekly/239/c/c.go:60
Function
getMinimums
(a []int)
misc/nowcoder/9224/c/c.go:37
Function
getNoZeroIntegers
(n int)
leetcode/weekly/171/a/a.go:8
Function
getNumberOfBacklogOrders
(orders [][]int)
leetcode/weekly/233/b/b.go:23
Function
getOrder
(a [][]int)
leetcode/weekly/237/c/c.go:20
Function
getPermutation
LC 60 逆康托展开
leetcode/main.go:328
Function
getProbability
(a []int)
leetcode/weekly/191/d/d.go:3
Function
getProbability2
总数是可以用组合数算出来的
leetcode/weekly/191/d/d.go:48
Function
getScores
github.com/EndlessCheng/codeforces-go
misc/nowcoder/6489/c/c.go:4
Function
getSmallestString
github.com/EndlessCheng/codeforces-go
leetcode/weekly/216/b/b.go:6
Function
getStrongest
(a []int, k int)
leetcode/weekly/192/b/b.go:5
Function
getSum
(a []int, query []int)
misc/nowcoder/9476/b/b.go:7
Function
getSumAbsoluteDifferences
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/41/b/b.go:4
Function
getTriggerTime
(increase [][]int, req [][]int)
leetcode/season/2020spring/c/c.go:5
Function
getWinner
github.com/EndlessCheng/codeforces-go
leetcode/weekly/200/b/b.go:4
Function
getXORSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/237/d/d.go:4
Function
goodDaysToRobBank
前后缀经典技巧 github.com/EndlessCheng/codeforces-go
leetcode/biweekly/67/b/b.go:6
Function
goodNodes
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/26/c/c.go:6
Function
grayCode
格雷码 https://oeis.org/A003188 https://oeis.org/A014550 https://en.wikipedia.org/wiki/Gray_code LC89 https://leetcode-cn.com/problems/gray-code/ 转换 http
copypasta/misc.go:473
Function
gridCollection
网格/矩阵上的搜索 NOTE: 对于 n*m 的网格图,BFS 最多只占用 O(min(n,m)) 的空间,而 DFS 最多会占用 O(nm) 的空间 易错题 https://codeforces.com/problemset/problem/540/C 思维转换 LCP31 https://le
copypasta/search.go:974
Function
gridGame
github.com/EndlessCheng/codeforces-go
leetcode/weekly/260/b/b.go:6
Function
groupThePeople
(groupSizes []int)
leetcode/weekly/166/b/b.go:3
Function
halfQuestions
github.com/EndlessCheng/codeforces-go
leetcode/lc-vscode/b/b.go:6
Function
halvesAreAlike
github.com/EndlessCheng/codeforces-go
leetcode/weekly/221/a/a.go:6
Function
hasAllCodes
(s string, k int)
leetcode/biweekly/27/b/b.go:5
Function
hasCycle
LC 141 O(1) 判环
leetcode/main.go:741
Function
hasValidPath
(grid [][]int)
leetcode/weekly/181/c/c.go:3
Method
heavyLightDecomposition
树链剖分/重链剖分 (HLD, Heavy Light Decomposition) 性质: 树上每个结点都属于且仅属于一条重链 如果 v-w 是一条轻边,那么 size[w] < size[v]/2 从根结点到任意结点所经过的重链数为 O(logn),轻边数为 O(logn) 与重心的关系(见 f
copypasta/graph_tree.go:1046
Method
heavyLightDecompositionByDepth
长链剖分 长链剖分和重链剖分一样,是把一棵树分成若干条不相交的链 但是,这里的重儿子不再是子树大小最大的,而是深度最大的子节点(长儿子) 根据这一定义可推出,从根结点到任意结点所经过的轻边数为 O(√n) (想象一颗长儿子不断递减的二叉树) https://oi-wiki.org/graph/hld
copypasta/graph_tree.go:1154
Function
highFive
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/2/b/b.go:6
Function
highestPeak
(g [][]int)
leetcode/biweekly/46/c/c.go:8
Function
hitBricks
LC 803 打砖块
leetcode/main.go:1519
Method
inOutTimestamp
每个节点的入出时间戳 应用:可以 O(1) 判断 fa 是否为 v 的祖先节点(是否在根到 v 的路径上) 例题 https://codeforces.com/problemset/problem/1328/E 好题(需要充分利用入出时间戳的性质)https://codeforces.com/pro
copypasta/graph_tree.go:148
Method
inRect
判断点 a 是否在以线段 l 为对角线的矩形内(矩形与坐标轴平行)
copypasta/geometry.go:381
Function
incenter
三角形内心(三条角平分线的交点) 三点坐标按对边长度加权平均 https://en.wikipedia.org/wiki/Incenter
copypasta/geometry.go:295
Function
increasingBST
github.com/EndlessCheng/codeforces-go
leetcode/weekly/100/b/b.go:6
Function
indexPairs
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/1/b/b.go:9
Function
init
github.com/EndlessCheng/codeforces-go
main/300-399/387E.go:11
Function
init
github.com/EndlessCheng/codeforces-go
main/900-999/979D.go:11
Function
init
todo 目前最快做法,待研究 https://codeforces.com/contest/484/submission/100555356 github.com/EndlessCheng/codeforces-go
main/400-499/484E.go:14
Function
init
()
misc/nowcoder/6219/c/c.go:7
Function
init
* k-d tree: k-dimensional tree; k 维树 https://en.wikipedia.org/wiki/K-d_tree 推荐 https://www.luogu.com.cn/blog/command-block/kdt-xiao-ji https://www.lu
copypasta/kd_tree.go:20
Function
init
()
leetcode/biweekly/2/d/d.go:24
Function
init
()
leetcode/biweekly/50/d/d.go:8
Function
init
()
leetcode/biweekly/46/d/d.go:8
Function
init
()
leetcode/biweekly/44/d/d.go:9
Function
init
()
leetcode/biweekly/30/d/d.go:6
Function
init
()
leetcode/biweekly/56/a/a.go:8
Function
init
()
leetcode/weekly/215/d/d.go:7
Function
init
()
leetcode/weekly/204/d/d.go:19
Function
init
()
leetcode/weekly/195/c/c.go:9
Function
init
github.com/EndlessCheng/codeforces-go
leetcode/weekly/198/c/c_test.go:11
Function
init
()
leetcode/weekly/257/d/d.go:10
Function
init
github.com/EndlessCheng/codeforces-go
leetcode/weekly/133/d/d.go:6
Function
init
()
leetcode/weekly/199/d/d.go:5
Function
init
github.com/EndlessCheng/codeforces-go
leetcode/weekly/197/c/c.go:9
Function
init
()
leetcode/weekly/62/d/d.go:5
Function
init
()
leetcode/weekly/241/d/d.go:8
Function
init
()
leetcode/weekly/247/d/d.go:8
Function
inorderTraversal
LC 94 Morris 中序遍历
leetcode/main.go:455
Function
interchangeableRectangles
* 哈希表统计比值的最简分数 将宽高比 w/h 化简为最简分数,用哈希表统计最简分数的个数。若有 $m$ 个宽高比相同的矩形,则可互换的矩形对有 $C_m2=\dfrac{m\cdot(m-1}{2}$ 个。遍历哈希表,累加所有可互换的矩形对的个数即为答案。 */ github.com/Endl
leetcode/weekly/258/b/b.go:11
Function
interpret
github.com/EndlessCheng/codeforces-go
leetcode/weekly/218/a/a.go:6
Method
intersection2
直线 a b 交点 - 两点式 线段求整数交点 https://codeforces.com/problemset/problem/1036/E
copypasta/geometry.go:399
Method
intersectionCircle
两圆交点 另一种写法是解二元二次方程组,精度更优
copypasta/geometry.go:507
Method
intersectionLine
直线与圆的交点
copypasta/geometry.go:487
Function
intersectionSizeTwo
LC 757
leetcode/main.go:1501
Method
inv
NxN 矩阵求逆 模板题 https://www.luogu.com.cn/problem/P4783
copypasta/math_matrix.go:179
Function
invalidTransactions
(transactions []string)
leetcode/weekly/151/a/a.go:8
Method
inverseGraphComponents
反图的连通分量 O(n+m) https://www.luogu.com.cn/blog/endlesscheng/solution-cf1242b https://codeforces.com/contest/190/problem/E https://codeforces.com/contest
copypasta/graph.go:2103
Function
invertTree
LC 226
leetcode/main.go:994
Function
ioq1174
()
main/1100-1199/1174F.go:63
Function
ioq1363D
()
main/1300-1399/1363D.go:61
Function
ioq1365
()
main/1300-1399/1365G.go:51
Function
ioq14
github.com/EndlessCheng/codeforces-go
main/1500-1599/1514E.go:9
Function
ioq23
()
main/1000-1099/1023E.go:49
Function
ioq79
()
main/1400-1499/1479A.go:46
Function
ioq86
()
main/1400-1499/1486C2.go:80
Function
isArmstrong
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/5/b/b.go:9
Method
isBipartite
二分图判定+染色 注:二分图也叫偶图 https://en.wikipedia.org/wiki/Bipartite_graph https://oi-wiki.org/graph/bi-graph/#_3 https://cp-algorithms.com/graph/bipartite-chec
copypasta/graph.go:2179
Function
isCircleRectangleOverlap
圆和矩形是否重叠 x1<x2, y1<y2 https://www.zhihu.com/question/24251545/answer/27184960 LC1401/双周赛23C https://leetcode-cn.com/contest/biweekly-contest-23/proble
copypasta/geometry.go:681
Function
isCompleteTree
github.com/EndlessCheng/codeforces-go
leetcode/weekly/115/b/b.go:6
Function
isCompleteTree2
我的憨憨写法
leetcode/weekly/115/b/b.go:24
Function
isCovered
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/54/a/a.go:4
Function
isCuboid
判断 6 个矩形是否为长方体的 6 个面 NEERC04 https://www.luogu.com.cn/problem/UVA1587
copypasta/misc.go:753
Function
isEvenOddTree
(root *TreeNode)
leetcode/weekly/209/b/b.go:5
Function
isGoodArray
(nums []int)
leetcode/weekly/161/d/d.go:3
Function
isMajorityElement
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/6/a/a.go:4
Function
isMonotonic
github.com/EndlessCheng/codeforces-go
leetcode/weekly/100/a/a.go:6
Function
isPathCrossing
(s string)
leetcode/weekly/195/a/a.go:3
Function
isPossible
LC 659 分割数组为长度至少为三且元素连续的子序列
leetcode/main.go:1404
Function
isPossible
(a []int)
leetcode/weekly/176/d/d.go:15
Function
isPossibleDivide
(nums []int, k int)
leetcode/weekly/168/b/b.go:5
Function
isPrefixOfWord
(sentence string, searchWord string)
leetcode/weekly/190/a/a.go:5
Function
isPrefixString
github.com/EndlessCheng/codeforces-go
leetcode/weekly/253/a/a.go:6
Function
isPrintable
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/35/d/d.go:4
Function
isSameAfterReversals
一行 github.com/EndlessCheng/codeforces-go
leetcode/weekly/273/a/a.go:6
← previous
next →
6,801–6,900 of 8,098, ranked by callers