Documentation ¶
Index ¶
Constants ¶
const ( Unexplored state = iota Pending Explored )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BSTIterator ¶
type BSTIterator struct {
// contains filtered or unexported fields
}
@lc code=start *
- Definition for a binary tree node.
- type TreeNode struct {
- Val int
- Left *TreeNode
- Right *TreeNode
- }
func (*BSTIterator) HasNext ¶
func (this *BSTIterator) HasNext() bool
* @return whether we have a next smallest number
type ByHeightAndRank ¶
type ByHeightAndRank [][]int
func (ByHeightAndRank) Len ¶
func (b ByHeightAndRank) Len() int
func (ByHeightAndRank) Less ¶
func (b ByHeightAndRank) Less(i, j int) bool
func (ByHeightAndRank) Swap ¶
func (b ByHeightAndRank) Swap(i, j int)
type IntHeap ¶
type IntHeap []int
An IntHeap is a max-heap of ints.
func (*IntHeap) Pop ¶
func (h *IntHeap) Pop() interface{}
Pop uses pointer receivers because they modify the slice's length,
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache is a data structure for Problem 145
type NumArray ¶
type NumArray struct {
// contains filtered or unexported fields
}
@lc code=start
func NumArrayConstructor ¶
type RandomizedCollection ¶
type RandomizedCollection struct {
// contains filtered or unexported fields
}
@lc code=start
func ConstructorRandom ¶
func ConstructorRandom() RandomizedCollection
* Initialize your data structure here.
func (*RandomizedCollection) GetRandom ¶
func (this *RandomizedCollection) GetRandom() int
* Get a random element from the collection.
func (*RandomizedCollection) Insert ¶
func (this *RandomizedCollection) Insert(val int) bool
* Inserts a value to the collection. Returns true if the collection did not already contain the specified element.
func (*RandomizedCollection) Remove ¶
func (this *RandomizedCollection) Remove(val int) bool
* Removes a value from the collection. Returns true if the collection contained the specified element.
type RandomizedSet ¶
type RandomizedSet struct {
// contains filtered or unexported fields
}
@lc code=start
func (*RandomizedSet) GetRandom ¶
func (this *RandomizedSet) GetRandom() int
* Get a random element from the set.
func (*RandomizedSet) Insert ¶
func (this *RandomizedSet) Insert(val int) bool
* Inserts a value to the set. Returns true if the set did not already contain the specified element.
func (*RandomizedSet) Remove ¶
func (this *RandomizedSet) Remove(val int) bool
* Removes a value from the set. Returns true if the set contained the specified element.
type Solution ¶
type Solution struct {
// contains filtered or unexported fields
}
@lc code=start
func SolConstructor ¶
type StockSpanner ¶
type StockSpanner struct {
// contains filtered or unexported fields
}
@lc code=start
func StockConstructor ¶
func StockConstructor() StockSpanner
func (*StockSpanner) Next ¶
func (this *StockSpanner) Next(price int) int
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
@lc code=start
func (*Trie) StartsWith ¶
* Returns if there is any word in the trie that starts with the given prefix.
type UnionFind ¶
type UnionFind struct {
// contains filtered or unexported fields
}
UnionFind data type contains the root and size of object in UnionFind Data structure
Source Files ¶
- 1.two-sum.go
- 10.regular-expression-matching.go
- 100.same-tree.go
- 1008.construct-binary-search-tree-from-preorder-traversal.go
- 102.binary-tree-level-order-traversal.go
- 1025.divisor-game.go
- 1029.two-city-scheduling.go
- 103.binary-tree-zigzag-level-order-traversal.go
- 1038.binary-search-tree-to-greater-sum-tree.go
- 1039.minimum-score-triangulation-of-polygon.go
- 104.maximum-depth-of-binary-tree.go
- 1044.longest-duplicate-substring.go
- 1046.last-stone-weight.go
- 105.construct-binary-tree-from-preorder-and-inorder-traversal.go
- 107.binary-tree-level-order-traversal-ii.go
- 11.container-with-most-water.go
- 1128.number-of-equivalent-domino-pairs.go
- 113.path-sum-ii.go
- 114.flatten-binary-tree-to-linked-list.go
- 1143.longest-common-subsequence.go
- 1170.compare-strings-by-frequency-of-the-smallest-character.go
- 118.pascals-triangle.go
- 119.pascals-triangle-ii.go
- 1191.k-concatenation-maximum-sum.go
- 1192.critical-connections-in-a-network.go
- 121.best-time-to-buy-and-sell-stock.go
- 122.best-time-to-buy-and-sell-stock-ii.go
- 1232.check-if-it-is-a-straight-line.go
- 1233.remove-sub-folders-from-the-filesystem.go
- 124.binary-tree-maximum-path-sum.go
- 125.valid-palindrome.go
- 1277.count-square-submatrices-with-all-ones.go
- 129.sum-root-to-leaf-numbers.go
- 13.roman-to-integer.go
- 130.surrounded-regions.go
- 131.palindrome-partitioning.go
- 1319.number-of-operations-to-make-network-connected.go
- 132.palindrome-partitioning-ii.go
- 1344.angle-between-hands-of-a-clock.go
- 1353.maximum-number-of-events-that-can-be-attended.go
- 136.single-number.go
- 137.single-number-ii.go
- 139.word-break.go
- 14.longest-common-prefix.go
- 141.linked-list-cycle.go
- 1411.number-of-ways-to-paint-n-3-grid.go
- 1438.longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit.go
- 145.binary-tree-postorder-traversal.go
- 146.lru-cache.go
- 148.sort-list.go
- 15.3-sum.go
- 151.reverse-words-in-a-string.go
- 152.maximum-product-subarray.go
- 153.find-minimum-in-rotated-sorted-array.go
- 16.3-sum-closest.go
- 160.intersection-of-two-linked-lists.go
- 162.find-peak-element.go
- 169.majority-element.go
- 17.letter-combinations-of-a-phone-number.go
- 171.excel-sheet-column-number.go
- 172.factorial-trailing-zeroes.go
- 173.binary-search-tree-iterator.go
- 189.rotate-array.go
- 19.remove-nth-node-from-end-of-list.go
- 190.reverse-bits.go
- 191.number-of-1-bits.go
- 198.house-robber.go
- 2.add-two-numbers.go
- 20.valid-parentheses.go
- 200.number-of-islands.go
- 201.bitwise-and-of-numbers-range.go
- 202.happy-number.go
- 204.count-primes.go
- 206.reverse-linked-list.go
- 207.course-schedule.go
- 208.implement-trie-prefix-tree.go
- 21.merge-two-sorted-lists.go
- 210.course-schedule-ii.go
- 212.word-search-ii.go
- 213.house-robber-ii.go
- 215.kth-largest-element-in-an-array.go
- 216.combination-sum-iii.go
- 217.contains-duplicate.go
- 22.generate-parentheses.go
- 221.maximal-square.go
- 222.count-complete-tree-nodes.go
- 225.implement-stack-using-queues.go
- 226.invert-binary-tree.go
- 228.summary-ranges.go
- 23.merge-k-sorted-lists.go
- 230.kth-smallest-element-in-a-bst.go
- 231.power-of-two.go
- 234.palindrome-linked-list.go
- 236.lowest-common-ancestor-of-a-binary-tree.go
- 237.delete-node-in-a-linked-list.go
- 238.product-of-array-except-self.go
- 24.swap-nodes-in-pairs.go
- 240.search-a-2-d-matrix-ii.go
- 242.valid-anagram.go
- 26.remove-duplicates-from-sorted-array.go
- 263.ugly-number.go
- 264.ugly-number-ii.go
- 268.missing-number.go
- 274.h-index.go
- 275.h-index-ii.go
- 278.first-bad-version.go
- 279.perfect-squares.go
- 28.implement-str-str.go
- 282.expression-add-operators.go
- 283.move-zeroes.go
- 3.longest-substring-without-repeating-characters.go
- 30.substring-with-concatenation-of-all-words.go
- 300.longest-increasing-subsequence.go
- 303.range-sum-query-immutable.go
- 306.additive-number.go
- 32.longest-valid-parentheses.go
- 322.coin-change.go
- 324.wiggle-sort-ii.go
- 328.odd-even-linked-list.go
- 329.longest-increasing-path-in-a-matrix.go
- 33.search-in-rotated-sorted-array.go
- 332.reconstruct-itinerary.go
- 334.increasing-triplet-subsequence.go
- 335.self-crossing.go
- 337.house-robber-iii.go
- 338.counting-bits.go
- 34.find-first-and-last-position-of-element-in-sorted-array.go
- 344.reverse-string.go
- 347.top-k-frequent-elements.go
- 35.search-insert-position.go
- 350.intersection-of-two-arrays-ii.go
- 357.count-numbers-with-unique-digits.go
- 36.valid-sudoku.go
- 367.valid-perfect-square.go
- 368.largest-divisible-subset.go
- 37.sudoku-solver.go
- 371.sum-of-two-integers.go
- 373.find-k-pairs-with-smallest-sums.go
- 374.guess-number-higher-or-lower.go
- 377.combination-sum-iv.go
- 38.count-and-say.go
- 380.insert-delete-get-random-o-1.go
- 381.insert-delete-get-random-o-1-duplicates-allowed.go
- 383.ransom-note.go
- 386.lexicographical-numbers.go
- 387.first-unique-character-in-a-string.go
- 388.longest-absolute-file-path.go
- 39.combination-sum.go
- 392.is-subsequence.go
- 395.longest-substring-with-at-least-k-repeating-characters.go
- 4.median-of-two-sorted-arrays.go
- 40.combination-sum-ii.go
- 402.remove-k-digits.go
- 406.queue-reconstruction-by-height.go
- 409.longest-palindrome.go
- 412.fizz-buzz.go
- 415.add-strings.go
- 43.multiply-strings.go
- 430.flatten-a-multilevel-doubly-linked-list.go
- 438.find-all-anagrams-in-a-string.go
- 441.arranging-coins.go
- 445.add-two-numbers-ii.go
- 451.sort-characters-by-frequency.go
- 46.permutations.go
- 461.hamming-distance.go
- 463.island-perimeter.go
- 464.can-i-win.go
- 468.validate-ip-address.go
- 476.number-complement.go
- 48.rotate-image.go
- 480.sliding-window-median.go
- 49.group-anagrams.go
- 493.reverse-pairs.go
- 496.next-greater-element-i.go
- 5.longest-palindromic-substring.go
- 50.pow-x-n.go
- 509.fibonacci-number.go
- 51.n-queens.go
- 518.coin-change-2.go
- 52.n-queens-ii.go
- 525.contiguous-array.go
- 528.random-pick-with-weight.go
- 53.maximum-subarray.go
- 540.single-element-in-a-sorted-array.go
- 543.diameter-of-binary-tree.go
- 55.jump-game.go
- 560.subarray-sum-equals-k.go
- 567.permutation-in-string.go
- 6.zig-zag-conversion.go
- 61.rotate-list.go
- 611.valid-triangle-number.go
- 62.unique-paths.go
- 629.k-inverse-pairs-array.go
- 64.minimum-path-sum.go
- 645.set-mismatch.go
- 66.plus-one.go
- 662.maximum-width-of-binary-tree.go
- 67.add-binary.go
- 674.longest-continuous-increasing-subsequence.go
- 678.valid-parenthesis-string.go
- 684.redundant-connection.go
- 69.sqrt-x.go
- 698.partition-to-k-equal-sum-subsets.go
- 7.reverse-integer.go
- 70.climbing-stairs.go
- 700.search-in-a-binary-search-tree.go
- 704.binary-search.go
- 72.edit-distance.go
- 73.set-matrix-zeroes.go
- 743.network-delay-time.go
- 746.min-cost-climbing-stairs.go
- 75.sort-colors.go
- 76.minimum-window-substring.go
- 763.partition-labels.go
- 77.combinations.go
- 770.basic-calculator-iv.go
- 771.jewels-and-stones.go
- 775.global-and-local-inversions.go
- 779.k-th-symbol-in-grammar.go
- 78.subsets.go
- 787.cheapest-flights-within-k-stops.go
- 79.word-search.go
- 8.string-to-integer-atoi.go
- 821.shortest-distance-to-a-character.go
- 844.backspace-string-compare.go
- 876.middle-of-the-linked-list.go
- 88.merge-sorted-array.go
- 886.possible-bipartition.go
- 89.gray-code.go
- 9.palindrome-number.go
- 90.subsets-ii.go
- 901.online-stock-span.go
- 91.decode-ways.go
- 910.smallest-range-ii.go
- 912.sort-an-array.go
- 914.x-of-a-kind-in-a-deck-of-cards.go
- 918.maximum-sum-circular-subarray.go
- 93.restore-ip-addresses.go
- 94.binary-tree-inorder-traversal.go
- 948.bag-of-tokens.go
- 95.unique-binary-search-trees-ii.go
- 958.check-completeness-of-a-binary-tree.go
- 96.unique-binary-search-trees.go
- 973.k-closest-points-to-origin.go
- 98.validate-binary-search-tree.go
- 986.interval-list-intersections.go
- 987.vertical-order-traversal-of-a-binary-tree.go
- 99.recover-binary-search-tree.go
- 993.cousins-in-binary-tree.go
- 997.find-the-town-judge.go
- bst.go
- listNode.go
- networkGraph.go
- node.go
- numFunc.go
- unionfind.go