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
Method
add
(b matrix)
copypasta/math_matrix.go:134
Method
add
(b Int)
copypasta/big.go:20
Method
add
(b rat)
copypasta/big.go:40
Method
add
(begin, end int, val int64)
copypasta/odt.go:61
Function
addNegabinary
负二进制数相加 LC1073/周赛139C https://leetcode-cn.com/problems/adding-two-negabinary-numbers/ https://leetcode-cn.com/contest/weekly-contest-139/
copypasta/misc.go:521
Function
addNegabinary
(a1, a2 []int)
leetcode/weekly/139/c/c.go:3
Function
addRungs
github.com/EndlessCheng/codeforces-go
leetcode/weekly/250/b/b.go:4
Function
addSpaces
Go 模拟 github.com/EndlessCheng/codeforces-go
leetcode/weekly/272/b/b.go:6
Function
addSpaces2
github.com/EndlessCheng/codeforces-go
leetcode/weekly/272/b/b.go:17
Method
adds
(b Int)
copypasta/big.go:11
Method
adds
(b rat)
copypasta/big.go:32
Method
adds
(b vec)
copypasta/geometry.go:183
Function
alertNames
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/36/b/b.go:9
Function
allCellsDistOrder
github.com/EndlessCheng/codeforces-go
leetcode/weekly/133/b/b.go:6
Function
angleClock
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/19/c/c.go:6
Method
angleTo
两向量夹角 det = |A||B|sinθ dot = |A||B|cosθ => tanθ = det / dot b 在 a 左侧时返回正值 b 在 a 右侧时返回负值
copypasta/geometry.go:229
Function
areAlmostEqual
github.com/EndlessCheng/codeforces-go
leetcode/weekly/232/a/a.go:4
Function
areConnected
(n int, threshold int, queries [][]int)
leetcode/weekly/211/d/d.go:22
Function
areNumbersAscending
Go 模拟 github.com/EndlessCheng/codeforces-go
leetcode/weekly/263/a/a.go:12
Function
areOccurrencesEqual
模拟 github.com/EndlessCheng/codeforces-go
leetcode/biweekly/57/a/a.go:6
Function
arrange
github.com/EndlessCheng/codeforces-go
misc/nowcoder/6916/b/b.go:4
Function
arrangeWords
(text string)
leetcode/weekly/189/b/b.go:8
Function
arrayRankTransform
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/18/a/a.go:6
Function
arraySign
github.com/EndlessCheng/codeforces-go
leetcode/weekly/236/a/a.go:4
Function
arrayStringsAreEqual
github.com/EndlessCheng/codeforces-go
leetcode/weekly/216/a/a.go:6
Function
arraysIntersection
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/10/a/a.go:4
Function
assignBikes
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/1/c/c.go:4
Function
assignTasks
(servers, tasks []int)
leetcode/weekly/243/c/c.go:17
Function
atMostNGivenDigitSet
github.com/EndlessCheng/codeforces-go
leetcode/weekly/101/c/c.go:6
Method
atan
()
copypasta/math_ntt.go:481
Function
average
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/29/a/a.go:6
Function
avoidFlood
(a []int)
leetcode/weekly/194/c/c.go:91
Function
balanceBST
(root *TreeNode)
leetcode/weekly/180/c/c.go:25
Function
balancedString
(s string)
leetcode/weekly/159/c/c.go:5
Function
baseNeg2
(n int)
leetcode/weekly/130/b/b.go:3
Function
beautySum
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/47/c/c.go:4
Function
beforeAndAfterPuzzles
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/8/b/b.go:9
Function
bestCoordinate
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/37/b/b.go:9
Function
bestTeamScore
github.com/EndlessCheng/codeforces-go
leetcode/weekly/211/c/c.go:6
Method
bfs
(n, st int, g [][]int)
copypasta/graph.go:296
Method
bfs01
01 最短路 https://oi-wiki.org/graph/bfs/#bfs_3 https://codeforces.com/blog/entry/22276 EXTRA: 1-2 最短路 https://codeforces.com/blog/entry/90917 例题: https:/
copypasta/graph.go:1196
Method
bin
30 for 1e9, 63 for int64, or bits.Len(MAX_VAL)
copypasta/trie01.go:30
Method
binarySearch
如果维护的数据(或者判断条件)具有单调性,我们就可以在线段树上二分 未找到时返回 n+1 o=1 [l,r] 1<=l<=r<=n https://codeforces.com/problemset/problem/1179/C
copypasta/segment_tree.go:245
Method
bipartiteFindOddLengthCycle
寻找二分图中的奇环(无奇环是该图为二分图的充要条件 https://www.zhihu.com/question/52978925) https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/Bipartite.java.html
copypasta/graph.go:2203
Function
bitsCollection
注:有关子集枚举的位运算技巧,见 search.go
copypasta/bits.go:316
Function
bitwiseComplement
github.com/EndlessCheng/codeforces-go
leetcode/weekly/128/a/a.go:6
Function
bonus
(n int, leadership [][]int, operations [][]int)
leetcode/season/2019fall/e/e.go:75
Method
boruvkaMST
Boruvka's algorithm 用于求解边权互不相同的无向图的最小生成森林 https://en.wikipedia.org/wiki/Bor%C5%AFvka%27s_algorithm https://oi-wiki.org/graph/mst/#boruvka https://www.
copypasta/graph.go:1598
Function
boxDelivering
(a [][]int, _, maxBoxes, maxWeight int)
leetcode/biweekly/41/d/d.go:33
Function
breakPalindrome
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/18/b/b.go:4
Function
buddyStrings
github.com/EndlessCheng/codeforces-go
leetcode/weekly/90/a/a.go:4
Function
bufferIO
bufio.NewWriter 相比 fmt.Println,每减少 1e5 次 Flush 可以加速约 200ms(Codeforces/AtCoder) 对比: 405ms https://codeforces.com/contest/1603/submission/135520593 187m
copypasta/io.go:23
Method
build
(a []int64, o, l, r int)
copypasta/segment_tree.go:215
Method
build
(a []int64, l, r int)
copypasta/segment_tree.go:340
Method
build
(a []int64, l, r int)
copypasta/segment_tree.go:411
Function
buildArray
github.com/EndlessCheng/codeforces-go
leetcode/weekly/248/a/a.go:4
Function
buildArray
(a []int, _ int)
leetcode/weekly/188/a/a.go:3
Function
buildCartesianTree
(a []int)
copypasta/cartesian_tree.go:17
Function
buildCartesianTree2
非指针版,返回每个节点的左右儿子的编号
copypasta/cartesian_tree.go:39
Method
buildDFA
EXTRA: AC 自动机 Aho–Corasick algorithm / Deterministic Finite Automaton (DFA) https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm https://en.wi
copypasta/trie.go:216
Function
buildPST
t := make([]*pstNode, 1, maxVersion+1) t[0] = buildPST(a, 1, len(a)) 或者 t := []*pstNode{buildPST(a, 1, len(a))}
copypasta/segment_tree.go:573
Function
buildPUF
t := make([]*pufNode, 1, maxVersion+1) t[0] = buildPUF(1, n)
copypasta/union_find.go:303
Function
buildSplay
(l, r int)
copypasta/splay_test.go:10
Function
buildTree
LC 106 从中序与后序遍历序列构造二叉树
leetcode/main.go:511
Function
busiestServers
(k int, starts, delta []int)
leetcode/biweekly/36/d/d.go:104
Function
busyStudent
(startTime []int, endTime []int, queryTime int)
leetcode/weekly/189/a/a.go:3
Method
cactusDFS
五元环 https://blog.csdn.net/weixin_30563319/article/details/96009073 https://nanti.jisuanke.com/t/A1644 拟阵 Matroid https://en.wikipedia.org/wiki/Matroid
copypasta/graph.go:4002
Method
cactusDFS2
另一种写法,基于栈
copypasta/graph.go:4045
Method
calcCC
DFS 应用:求连通分量以及每个点所属的连通分量 (Connected Component, CC) ccIDs 的值从 1 开始
copypasta/graph.go:271
Function
calcEquation
LC 399 带权并查集
leetcode/main.go:1225
Function
calcFibonacci
a(n) = p*a(n-1) + q*a(n-2) 注意:数列从 0 开始,若题目从 1 开始则输入的 n 为 n-1 https://ac.nowcoder.com/acm/contest/9247/A m 项递推式,以及包含常数项的情况见《挑战》P201 a(n) = a(n-1) + a(n
copypasta/math_matrix.go:115
Function
calculate
表达式计算(无括号) LC227 https://leetcode-cn.com/problems/basic-calculator-ii/
copypasta/misc.go:630
Function
calculateTime
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/7/a/a.go:4
Function
canArrange
(a []int, k int)
leetcode/weekly/195/b/b.go:3
Function
canBeEqual
(target []int, arr []int)
leetcode/biweekly/27/a/a.go:5
Function
canBeIncreasing
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/55/a/a.go:6
Function
canBeTypedWords
github.com/EndlessCheng/codeforces-go
leetcode/weekly/250/a/a.go:6
Function
canBeValid
* 全部变为左括号或右括号 首先 $s$ 长度不能为奇数,此时应直接返回 $\texttt{false}$。 然后就是用括号问题的经典技巧了:通过一个变量记录括号的平衡度。 以变左括号为例,将所有可以变化的括号变为左括号,如果这样中间还是会出现平衡度小于 $0$ 的情况,那么就返回 $\tex
leetcode/biweekly/68/c/c.go:14
Function
canChoose
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/46/b/b.go:4
Function
canConstruct
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/23/b/b.go:4
Function
canConvert
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/6/d/d.go:4
Function
canConvertString
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/32/b/b.go:4
Function
canDistribute
todo O(m*2^m) https://leetcode-cn.com/problems/distribute-repeating-integers/solution/om2m-c-56ms-100-by-hqztrue-qmfl/ github.com/EndlessCheng/codefor
leetcode/biweekly/39/d/d.go:6
Function
canDivideIntoSubsequences
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/4/d/d.go:4
Function
canEat
github.com/EndlessCheng/codeforces-go
leetcode/weekly/226/c/c.go:6
Function
canFormArray
github.com/EndlessCheng/codeforces-go
leetcode/weekly/213/a/a.go:4
Function
canMakeArithmeticProgression
(a []int)
leetcode/weekly/196/a/a.go:5
Function
canMakePaliQueries
github.com/EndlessCheng/codeforces-go
leetcode/weekly/152/c/c.go:4
Function
canMouseWin
github.com/EndlessCheng/codeforces-go
leetcode/weekly/224/d/d.go:4
Function
canReach
github.com/EndlessCheng/codeforces-go
leetcode/weekly/242/c/c.go:4
Function
canSeePersonsCount
* 单调栈的应用 对第 $i$ 个人来说,他能看到的人中,靠右的不能被靠左的挡住,所以这些人从左往右的高度必须是严格单调递增的。 因此可以倒序遍历 $\textit{heights}$,用单调栈来维护人的高度,将 $\textit{heights}[i]$ 压入单调栈的同时,统计栈内比他矮的人数
leetcode/biweekly/57/d/d.go:16
Function
candy
LC 135
leetcode/main.go:679
Method
centroidDecomposition
点分治 - 重心分解(CD, Centroid Decomposition) https://oi-wiki.org/graph/tree-divide/ todo https://zhuanlan.zhihu.com/p/359209926 https://codeforces.com/blog/
copypasta/graph_tree.go:458
Function
chalkReplacer
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/54/b/b.go:4
Function
champernowneConstant
钱珀瑙恩数 Champernowne constant https://en.wikipedia.org/wiki/Champernowne_constant https://oeis.org/A033307 返回第 k 位数字 https://leetcode-cn.com/contest/esp
copypasta/misc.go:872
Function
change
github.com/EndlessCheng/codeforces-go
misc/nowcoder/6218/a/a.go:6
Function
check
github.com/EndlessCheng/codeforces-go
leetcode/weekly/227/a/a.go:6
Function
checkAlmostEquivalent
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/65/a/a.go:4
Function
checkArithmeticSubarrays
github.com/EndlessCheng/codeforces-go
leetcode/weekly/212/b/b.go:6
Function
checkIfCanBreak
(s, t string)
leetcode/biweekly/25/c/c.go:27
← previous
next →
6,401–6,500 of 8,098, ranked by callers