Documentation
¶
Overview ¶
Package snippets は SNIPPETS.md と等価な内容を 1 ファイルにまとめたもの。 このファイル自体がビルド・テスト対象となるため、SNIPPETS.md の各ブロックが 単独でコンパイル可能であることを保証する。
実利用ではこのファイルを import せず、SNIPPETS.md の該当セクションをコピペして使う。
Index ¶
- func Abs[T Number](x T) T
- func BFS(g AdjList, src int) []int
- func BinSearch[T Ordered](xs []T, target T) int
- func BinSearchFunc(n int, pred func(i int) bool) int
- func Chunk[T any](xs []T, n int) [][]T
- func Clamp[T Number](x, lo, hi T) T
- func Contains[T comparable](xs []T, target T) bool
- func CountBy[T any, K comparable](xs []T, fn func(T) K) map[K]int
- func CountChars(s string) map[rune]int
- func DFS(g AdjList, src int) []int
- func Dijkstra(g AdjList, src int) []int64
- func Filter[T any](xs []T, pred func(T) bool) []T
- func GCD[T Integer](a, b T) T
- func IndexOf[T comparable](xs []T, target T) int
- func IsAnagram(a, b string) bool
- func IsPalindrome(s string) bool
- func IsPalindromeFold(s string) bool
- func IsPrime(n int) bool
- func LCM[T Integer](a, b T) T
- func LowerBound[T Ordered](xs []T, target T) int
- func Map[T, U any](xs []T, fn func(T) U) []U
- func Max[T Number](a, b T) T
- func Min[T Number](a, b T) T
- func ModPow(base, exp, m int64) int64
- func NewStdoutWriter() *bufio.Writer
- func Reduce[T, U any](xs []T, init U, fn func(U, T) U) U
- func Reverse[T any](xs []T) []T
- func ReverseInPlace[T any](xs []T)
- func ReverseString(s string) string
- func Sieve(n int) []bool
- func Sum[T Number](xs []T) T
- func Unique[T comparable](xs []T) []T
- func UpperBound[T Ordered](xs []T, target T) int
- type AdjList
- type Deque
- type Edge
- type Integer
- type Number
- type Ordered
- type PQ
- type Queue
- type Scanner
- type Stack
- type Trie
- type UnionFind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](xs []T, target T) bool
func CountBy ¶
func CountBy[T any, K comparable](xs []T, fn func(T) K) map[K]int
func CountChars ¶
func IndexOf ¶
func IndexOf[T comparable](xs []T, target T) int
func IsPalindrome ¶
func IsPalindromeFold ¶
func LowerBound ¶
func NewStdoutWriter ¶
func ReverseInPlace ¶
func ReverseInPlace[T any](xs []T)
func ReverseString ¶
func Unique ¶
func Unique[T comparable](xs []T) []T
func UpperBound ¶
Types ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func NewScannerFrom ¶
func NewStdinScanner ¶
func NewStdinScanner() *Scanner
func (*Scanner) NextString ¶
type UnionFind ¶
type UnionFind struct {
// contains filtered or unexported fields
}
func NewUnionFind ¶
Click to show internal directories.
Click to hide internal directories.