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
findBestValue
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/16/b/b.go:6
Function
findCenter
github.com/EndlessCheng/codeforces-go
leetcode/weekly/232/b/b.go:4
Method
findCentroid
树的重心 性质: 以重心为根时,最大子树结点数最少,且所有子树的大小都不超过 节点数/2 反之,若存在一颗子树其大小超过 节点数/2,则重心在该子树中 一棵树最多有两个重心,且相邻 拥有奇数个节点的树只有一个重心 树中所有点到某个点的距离和中,到重心的距离和是最小的;如果有两个重心,那么距离和一样
copypasta/graph_tree.go:418
Function
findCriticalAndPseudoCriticalEdges
(n int, edges [][]int)
leetcode/weekly/194/d/d.go:5
Method
findCutVertices
* Topic - DFS 树 讲解+套题 https://codeforces.com/blog/entry/68138 好题:https://codeforces.com/problemset/problem/1325/F */ 割点(割顶) cut vertices / articulatio
copypasta/graph.go:656
Function
findDiagonalOrder
(mat [][]int)
leetcode/weekly/186/c/c.go:3
Function
findDifferentBinaryString
github.com/EndlessCheng/codeforces-go
leetcode/weekly/255/b/b.go:9
Function
findDifferentBinaryString2
康托对角线
leetcode/weekly/255/b/b.go:22
Method
findEdgeBCC
e-BCC:删除无向图中所有的割边后,剩下的每一个 CC 都是 e-BCC 缩点后形成一颗 bridge tree 模板题 https://codeforces.com/problemset/problem/1000/E 较为综合的一道题 http://codeforces.com/problems
copypasta/graph.go:906
Function
findEvenNumbers
枚举所有三位数偶数 github.com/EndlessCheng/codeforces-go
leetcode/weekly/270/a/a.go:6
Function
findGCD
github.com/EndlessCheng/codeforces-go
leetcode/weekly/255/a/a.go:4
Function
findGoodStrings
(n int, s1 string, s2 string, evil string)
leetcode/weekly/182/d/d.go:5
Function
findIntegers
LC 600 不含连续 1 的非负整数
leetcode/main.go:1349
Function
findItinerary
LC 332
leetcode/main.go:1196
Function
findKthBit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/201/b/b.go:4
Function
findKthPositive
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/32/a/a.go:4
Function
findLatestStep
github.com/EndlessCheng/codeforces-go
leetcode/weekly/203/c/c.go:4
Function
findLeastNumOfUniqueInts
(a []int, k int)
leetcode/weekly/193/b/b.go:5
Function
findLengthOfShortestSubarray
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/34/c/c.go:6
Function
findLexSmallestString
github.com/EndlessCheng/codeforces-go
leetcode/weekly/211/b/b.go:4
Function
findLucky
(arr []int)
leetcode/weekly/182/a/a.go:3
Function
findMaxValueOfEquation
(a [][]int, k int)
leetcode/weekly/195/d/d.go:34
Function
findMaximumXOR
上面也可以用哈希表做 https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/discuss/91049/Java-O(n)-solution-using-bit-manipulation-and-HashMap/95
copypasta/trie01.go:89
Function
findMinFibonacciNumbers
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/24/b/b.go:4
Function
findMode
LC 501
leetcode/main.go:1293
Function
findNumOfValidWords
github.com/EndlessCheng/codeforces-go
leetcode/weekly/152/d/d.go:4
Function
findNumbers
(nums []int)
leetcode/weekly/168/a/a.go:5
Function
findOcurrences
(text string, first string, second string)
leetcode/weekly/140/a/a.go:5
Function
findOriginalArray
排序+遍历 github.com/EndlessCheng/codeforces-go
leetcode/biweekly/61/b/b.go:8
Function
findPairs
(a, b, c, d int64)
misc/nowcoder/9247/c/c.go:26
Function
findPeakElement
LC 162
leetcode/main.go:906
Method
findPseudoClique
todo 基于 Capacity Scaling 的弱多项式复杂度最小费用流算法 https://ouuan.github.io/post/%E5%9F%BA%E4%BA%8E-capacity-scaling-%E7%9A%84%E5%BC%B1%E5%A4%9A%E9%A1%B9%E5%BC%8
copypasta/graph.go:3765
Function
findRedundantDirectedConnection
周赛出的是无向图,这里写的是有向图 Update (2017-09-26): We have overhauled the problem description + test cases and specified clearly the graph is an undirected graph.
leetcode/weekly/51/c/c.go:9
Function
findRepeatNumber
剑指 Offer 03. 数组中重复的数字 O(1) 空间复杂度做法
leetcode/main.go:1736
Function
findRotation
github.com/EndlessCheng/codeforces-go
leetcode/weekly/244/a/a.go:4
Function
findSmallestRegion
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/13/b/b.go:4
Function
findSmallestSetOfVertices
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/33/b/b.go:4
Function
findSolution
github.com/EndlessCheng/codeforces-go
leetcode/weekly/160/a/a.go:4
Function
findSpecialInteger
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/15/a/a.go:4
Function
findTheCity
(n int, edges [][]int, distanceThreshold int)
leetcode/weekly/173/c/c.go:3
Function
findTheDistanceValue
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/22/a/a.go:4
Function
findTheLongestSubstring
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/21/b/b.go:6
Function
findTheWinner
github.com/EndlessCheng/codeforces-go
leetcode/weekly/236/b/b.go:4
Method
findVertexBCC
无向图的双连通分量 Biconnected Components (BCC) 也叫重连通图 v-BCC:任意割点都是至少两个不同 v-BCC 的公共点 广义圆方树 https://oi-wiki.org/graph/bcc/ https://www.csi
copypasta/graph.go:801
Function
findingUsersActiveMinutes
github.com/EndlessCheng/codeforces-go
leetcode/weekly/235/b/b.go:4
Function
firstDayBeenInAllRooms
* 前缀和优化 DP 根据题意,首次进入一个房间时,下一天是一定要回到 $\textit{nextVisit}[i]$ 房间的,下文简称为「回访」。 于是定义状态 $f[i]$ 表示从房间 $i$ 回访到房间 $\textit{nextVisit}[i]$(记为 $j$),再重新访问到房间 $i
leetcode/weekly/257/c/c.go:24
Function
firstMissingPositive
LC 41 对未排序数组求 mex,不使用 map 的 O(n) 做法
leetcode/main.go:216
Function
firstPalindrome
遍历,找第一个回文串 github.com/EndlessCheng/codeforces-go
leetcode/weekly/272/a/a.go:6
Method
fix
(i int)
copypasta/heap.go:90
Function
fixedPoint
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/1/a/a.go:4
Function
flipChess
(g []string)
leetcode/season/2021fall/c/c.go:55
Method
floor
max <= key return nil if not found
copypasta/bst.go:96
Function
floorRootN
返回 floor(pow(x, 1/n)) x>=0, n>1
copypasta/geometry.go:130
Method
floydWarshallBitset
位压缩版 O(n^3/w) LC双周赛67C https://leetcode-cn.com/problems/detonate-the-maximum-bombs/
copypasta/graph.go:1352
Method
foreach
中序遍历(如果是多重集请用下面的 foreachM)
copypasta/bst.go:309
Method
foreachM
中序遍历,适用于多重集
copypasta/bst.go:322
Function
fourSum
LC 18
leetcode/main.go:14
Function
fraction
(exp []int)
leetcode/season/2019fall/b/b.go:3
Function
fractionToDecimal
分数转小数 https://en.wikipedia.org/wiki/Repeating_decimal Period of decimal representation of 1/n, or 0 if 1/n terminates https://oeis.org/A051626 The per
copypasta/misc.go:570
Function
freqAlphabets
(s string)
leetcode/weekly/170/a/a.go:3
Function
frequencySort
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/38/a/a.go:6
Function
friendRequests
github.com/EndlessCheng/codeforces-go
leetcode/weekly/267/d/d.go:4
Function
frogPosition
(n int, edges [][]int, time int, target int)
leetcode/weekly/179/d/d.go:3
Function
fullJustify
LC 68
leetcode/main.go:356
Function
furthestBuilding
github.com/EndlessCheng/codeforces-go
leetcode/weekly/213/c/c.go:6
Function
fwtAND
(a []int, op int)
copypasta/math_fwt.go:40
Function
fwtOR
* 快速沃尔什变换 fast Walsh–Hadamard transform, FWT, FWHT 在算法竞赛中,FWT 是用于解决对下标进行【位运算卷积】问题的方法 一个常见的应用场景是对频率数组求 FWT 例如,求一个数组的三个元素的最大异或和,在值域不大的情况下, 可以先求出该数组的频率数组
copypasta/math_fwt.go:28
Function
fwtXOR
(a []int, op int)
copypasta/math_fwt.go:52
Function
game
(a []int, b []int)
leetcode/season/2019fall/a/a.go:3
Function
gameTheoryCollection
* 博弈论 Game Theory https://en.wikipedia.org/wiki/Game_theory 定义必胜状态为先手必胜的状态,必败状态为先手必败的状态 定理 1:没有后继状态的状态是必败状态 定理 2:一个状态是必胜状态当且仅当存在至少一个必败状态为它的后继状态 定理 3:一
copypasta/games.go:36
Function
gaussJordanElimination
高斯消元 Gaussian elimination O(n^3) 列主元消去法 求解 Ax=B,A 为方阵,返回解(无解或有无穷多组解) https://en.wikipedia.org/wiki/Gaussian_elimination https://en.wikipedia.org/wik
copypasta/math_matrix.go:250
Function
gcdOfStrings
(s1 string, s2 string)
leetcode/weekly/139/a/a.go:5
Function
gcdSort
(a []int)
leetcode/weekly/257/d/d.go:22
Function
generateMaxNodes01TrieData
n 个 [0, 2^k) 范围内的数构成的 0-1 trie 至多可以有多少个节点? n*(k-logn) + 2^(logn+1) - 1, 这里 logn = int(log_2(n)) 实际使用的时候,可以简单地用 n*(k+2-logn) 代替 构造方法:先用不超过 n 的最大的 2 的幂次
copypasta/trie01.go:260
Function
generateSentences
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/13/c/c.go:9
Function
generateTheString
(n int)
leetcode/weekly/179/a/a.go:5
Method
get
(key rbKeyType)
copypasta/red_black_tree.go:153
Method
get
()
copypasta/segment_tree.go:396
Function
getAllElements
(root1 *TreeNode, root2 *TreeNode)
leetcode/weekly/169/b/b.go:8
Function
getAverages
* O(n) 滑动窗口 */ github.com/EndlessCheng/codeforces-go
leetcode/weekly/269/b/b.go:7
Function
getBiggestThree
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/53/c/c.go:4
Function
getCircleCenter
三点确定一圆 用三角形外心求解,见 circumcenter 给定半径和一条有向的弦,求该弦右侧的圆心(即 ao 在 ab 右侧)
copypasta/geometry.go:475
Function
getCollisionTimes
(a [][]int)
leetcode/weekly/230/d/d.go:74
Function
getConcatenation
github.com/EndlessCheng/codeforces-go
leetcode/weekly/249/a/a.go:4
Function
getCoprimes
(a []int, edges [][]int)
leetcode/biweekly/46/d/d.go:20
Function
getDecimalValue
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
leetcode/weekly/167/a/a.go:15
Function
getDescentPeriods
* 分组循环 将 $\textit{prices}$ 按照平滑下降的定义分成若干组。例如 $[3,2,1,4]$ 分为 $[3,2,1]$ 和 $[4]$ 两组。 对于每一组的所有非空子数组,都是平滑下降的。设该组长度为 $m$,则该组的非空子数组个数为 $$ C_{m+1}^2 = \dfr
leetcode/weekly/272/c/c.go:21
Function
getDirections
* 一题双解:BFS / 最近公共祖先 #### 解法一:DFS + BFS 我们可以从起点出发,通过 BFS 找到终点,同时记录每个点的来源节点和方向,在找到终点后,顺着来源节点往回走,同时记录答案。 由于要往父节点方向走,我们需要先通过一次 DFS 记录每个节点的父节点,这样就可以在 BF
leetcode/weekly/270/c/c.go:29
Function
getDirections2
(root *TreeNode, startValue, destValue int)
leetcode/weekly/270/c/c.go:65
Function
getDistances
O(n) 做法:哈希表 + 枚举相同元素 github.com/EndlessCheng/codeforces-go
leetcode/weekly/273/c/c.go:6
Function
getFolderNames
(names []string)
leetcode/weekly/194/b/b.go:5
Function
getHappyString
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/24/c/c.go:4
Function
getIntersectionNode
LC 160
leetcode/main.go:885
Function
getKth
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/22/c/c.go:6
Function
getLastMoment
(n int, left []int, right []int)
leetcode/weekly/196/b/b.go:3
Function
getLengthOfOptimalCompression
github.com/EndlessCheng/codeforces-go
leetcode/weekly/199/d/d.go:22
Function
getLucky
Go 模拟 github.com/EndlessCheng/codeforces-go
leetcode/weekly/251/a/a.go:6
Function
getMaxGridHappiness
(n, m, c1, c2 int)
leetcode/weekly/215/d/d.go:49
Function
getMaxLen
github.com/EndlessCheng/codeforces-go
leetcode/weekly/204/b/b.go:4
Function
getMaxLength
github.com/EndlessCheng/codeforces-go
misc/nowcoder/6219/b/b.go:4
← previous
next →
6,701–6,800 of 8,098, ranked by callers