MCPcopy Create free account

hub / github.com/HuberTRoy/leetCode / functions

Functions332 in github.com/HuberTRoy/leetCode

↓ 56 callersMethodget
:type key: int :rtype: int
Design/LRUCache.py:65
↓ 51 callersMethodpop
(self)
Stack/GetMinStack.py:41
↓ 29 callersMethodpush
(self, value)
Stack/GetMinStack.py:38
↓ 17 callersFunctionhelper
(x, y, result=0)
Array/FootballFans.py:61
↓ 10 callersMethodreverse
:type x: int :rtype: int
String/ReverseInteger.py:33
↓ 7 callersMethodadd
(self, value)
Tree/BinarySearchTree.py:36
↓ 7 callersMethodsplit
(l)
Sorted/SortList.py:160
↓ 5 callersMethodempty
(self)
Stack/GetMinStack.py:50
↓ 5 callersMethodpush
(self, value)
Stack/ImplementQueueUsingStack.py:42
↓ 4 callersFunctioncheckStop
(matrix, x, y)
Array/SpiralMatrix.py:39
↓ 4 callersFunctionconstruct
(treeDict)
Tree/serializeAndDeserialize.py:88
↓ 4 callersMethodget_min
返回栈顶但不压出。
Stack/GetMinStack.py:79
↓ 4 callersMethodget_top
查看栈顶的数据但不压出。
Stack/GetMinStack.py:44
↓ 4 callersMethodpop
(self)
Stack/ImplementQueueUsingStack.py:48
↓ 4 callersFunctionsplit
(arr)
Array/KthLargestElementInAnArray.js:37
↓ 3 callersMethodsetBreakable
(self, enable)
Tree/Trie.py:40
↓ 2 callersMethod_put
{ key: {'value': value, 'weight': self.current_cache_number} } {
Design/LRUCache.py:114
↓ 2 callersMethod_replace
replace the existed key to new value and weight.
Design/LRUCache.py:139
↓ 2 callersMethodaddNext
(self, nextNode)
Tree/Trie.py:37
↓ 2 callersMethodbi_search
(self, nums, target, lo, hi)
Array/SearchInRotatedSortedArrayII.py:68
↓ 2 callersMethodbi_search
(self, nums, target, lo, hi)
Array/SearchInRotatedSortedArray.py:80
↓ 2 callersMethodconstruct
(self, constructDict)
Tree/serializeAndDeserialize.py:77
↓ 2 callersFunctiongetKNodes
(head)
Array/ReverseNodesInk-Group.js:22
↓ 2 callersMethodgetRest
(self, l1, l2, rest=0)
Array/AddTwoNumbers.py:73
↓ 2 callersFunctionjudgeEqual
(cards, target)
DP/PickCards.py:88
↓ 2 callersMethodremove
Removes a value from the set. Returns true if the set contained the specified element. :type val: int :rtype: bool
Design/InsertDeleteGetRandomO(1).py:95
↓ 2 callersFunctionreverse
(nodes)
Array/ReverseNodesInk-Group.js:35
↓ 2 callersMethodright
(self, matrix, x, y, result, stop)
Array/SpiralMatrix.py:59
↓ 2 callersMethodsearch
(self, value)
Tree/BinarySearchTree.py:63
↓ 2 callersMethodserialize
(self)
Tree/serializeAndDeserialize.py:80
↓ 1 callersMethod__init__
这里用实例对象。
Stack/GetMinStack.py:28
↓ 1 callersMethod_addTwoNumbers
(self, l1, l2)
Array/AddTowNumbersII.py:76
↓ 1 callersMethod_add_exist_key_weight
(self, key)
Design/LRUCache.py:82
↓ 1 callersMethod_decomposeAndMerge
(self, unsorted_list_A, unsorted_list_B, key)
Array/KthLargestElementInAnArray.py:103
↓ 1 callersMethod_get
(self, key)
Design/LRUCache.py:72
↓ 1 callersMethod_getMiddle
返回快排所需的基准点, 左右中中间选择一个。 若不足3位,选左。
Array/KthLargestElementInAnArray.py:68
↓ 1 callersMethod_middlePrint
(self, root, result)
Tree/BinarySearchTree.py:100
↓ 1 callersMethod_put_and_remove
(self, key, value)
Design/LRUCache.py:129
↓ 1 callersMethod_search
(self, root, word)
Tree/Trie.py:77
↓ 1 callersMethod_search
(self, root, value)
Tree/BinarySearchTree.py:67
↓ 1 callersMethod_serialize
(self)
Tree/serializeAndDeserialize.py:73
↓ 1 callersMethod_startWith
(self, root, prefix)
Tree/Trie.py:102
↓ 1 callersMethod_suffPrint
(self, root, result)
Tree/BinarySearchTree.py:116
↓ 1 callersMethod_twoSum
:type nums: List[int] :type target: int :rtype: List[int]
Array/two_sum.py:58
↓ 1 callersMethodbinarySearch
(self, rawList, target, index=0)
Array/Search2DMatrix.py:55
↓ 1 callersMethodbinarySearch2
(self, rawList, target)
Array/Search2DMatrix.py:81
↓ 1 callersMethodcheck_cache_capacity
True is reached capacity. False is not.
Design/LRUCache.py:154
↓ 1 callersMethodcoinChange
:type coins: List[int] :type amount: int :rtype: int
DP/CoinChange.py:53
↓ 1 callersFunctioncombined
(list1, list2)
Sorted/sotred.py:70
↓ 1 callersFunctiondeserialize
(string)
Tree/serializeAndDeserialize.py:85
↓ 1 callersMethoddown
(self, matrix, x ,y, result, stop)
Array/SpiralMatrix.py:75
↓ 1 callersFunctionfastSort
(shuffledList)
Sorted/sotred.py:125
↓ 1 callersMethodfind_bi
(self, nums, target)
Array/SlidingWindowMaximum.py:47
↓ 1 callersMethodfind_data
(self, root: TreeNode)
Tree/KthSmallestElementInABST.py:61
↓ 1 callersMethodfind_left
(self, nums, target)
Array/FindFirstAndLastPositionOfElementInSortedArray.py:97
↓ 1 callersMethodfind_right
(self, nums, target)
Array/FindFirstAndLastPositionOfElementInSortedArray.py:81
↓ 1 callersMethodfind_rotate
(self, nums)
Array/SearchInRotatedSortedArrayII.py:47
↓ 1 callersMethodfind_rotate
(self, nums)
Array/FindMinimumInRotatedSortedArrayII.py:34
↓ 1 callersMethodfind_rotate
(self, nums)
Array/FindMinimumInRotatedSortedArray.py:31
↓ 1 callersMethodfind_rotate
(self, nums)
Array/SearchInRotatedSortedArray.py:64
↓ 1 callersMethodgetEqualNodes
(self, l1, l2)
Array/AddTowNumbersII.py:89
↓ 1 callersFunctiongetFootballFans
[[0, 0, 0].....] 从 0,0 开始,如果遇到1则进入递归: 递归结束条件: 四周都是 0或边界。 结束时将搜索到的人数添加。 未结束时根据四周的情况进入相同的递归。
Array/FootballFans.py:44
↓ 1 callersMethodgetRest
(self, l1, l2, rest=0)
Array/AddTowNumbersII.py:122
↓ 1 callersMethodget_init_nodes
(self)
Tree/CompleteBinaryTreeInserter.py:81
↓ 1 callersMethodget_up_left
(self, x, y)
Array/MinimumPathSum.py:32
↓ 1 callersFunctionhelper
(stacks)
Stack/ReverseAStackByRecursive.py:15
↓ 1 callersMethodinsert
:type v: int :rtype: int
Tree/CompleteBinaryTreeInserter.py:103
↓ 1 callersMethodinsert
:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]
Array/InsertInterval.py:38
↓ 1 callersMethodisInterleave
:type s1: str :type s2: str :type s3: str :rtype: bool
DP/InterleavingString.py:133
↓ 1 callersMethodleft
(self, matrix, x, y, result, stop)
Array/SpiralMatrix.py:90
↓ 1 callersMethodletter_all_capital_or_lower
(self, word)
String/DetectCapital.py:63
↓ 1 callersMethodletter_all_lower
(self, word)
String/DetectCapital.py:81
↓ 1 callersMethodlongestPalindrome
(self, s)
String/LongestPalindromicSubstrings.py:46
↓ 1 callersMethodmakeATrieNodes
(self, word)
Tree/Trie.py:115
↓ 1 callersMethodmakeAround
(self, x, y)
Array/SurroundedRegions.py:58
↓ 1 callersFunctionmakeAroundXY
(x, y)
Array/FootballFans.py:33
↓ 1 callersMethodmakeAroundXY
(self, x, y)
Array/MaxAreaOfIsland.py:32
↓ 1 callersMethodmakeCombinations
(self, split_list)
String/LongestPalindromicSubstrings.py:81
↓ 1 callersMethodmakeXY
(self, x, y)
Array/NumberOfIslands.py:33
↓ 1 callersFunctionmaxALEminB
思路与前一致,前一版的主要瓶颈在于有太多重复的数据,若可以将这些重复的数据统计到一起,可以极大的减少对比次数。 [[3], [2], [1]] 现在变为 [[(3, 1)], [(2, 1)], [(1, 1)]]
DP/MaxASubarrayLessThanMinBSubarray.py:83
↓ 1 callersFunctionmaxCardsScope
(cards)
DP/PickCards.py:63
↓ 1 callersFunctionmerge
(arr, arr2)
Array/KthLargestElementInAnArray.js:45
↓ 1 callersFunctionmergeArray
这个测试数据的结构是我自己写的,所以第一步是打散数组。 1. 根据第一个字符出现的位置进行排序。 2. 迭代,记录i的头,记录i的末尾,末尾与下一个i的头做比较,若前者记录的大或相等则末尾替换为两者中较大的一个。 3. 不大的情况添加
Array/MergeArray.py:63
↓ 1 callersMethodmiddlePrint
(self)
Tree/BinarySearchTree.py:109
↓ 1 callersMethodquickSort
每次都选一个基准点,大的放在右边,小的放在左边,等于的随便归到一个地方,不断拆分拆分。 这里直接选用[0],当然这种情况下往往会发生不理想的情况, 不理想的情况表示每次恰好都是最小或最大,这样的结果会直接导致算法变为O(n^2
Array/KthLargestElementInAnArray.py:46
↓ 1 callersFunctionreduce
(splitedList)
Sorted/sotred.py:99
↓ 1 callersFunctionreverseStack
(stacks)
Stack/ReverseAStackByRecursive.py:12
↓ 1 callersMethodsearch
DFS/WordSearch.py:206
↓ 1 callersFunctionsort
(arr)
Array/KthLargestElementInAnArray.js:8
↓ 1 callersFunctionsort2
(arr)
Array/KthLargestElementInAnArray.js:76
↓ 1 callersMethodsuffPrint
(self)
Tree/BinarySearchTree.py:125
↓ 1 callersMethodthreeSum
:type nums: List[int] :rtype: List[List[int]]
Array/ThreeSum.py:45
↓ 1 callersMethodup
(self, matrix, x, y, result, stop)
Array/SpiralMatrix.py:105
Method__eq__
(self, other)
Tree/Trie.py:43
Method__init__
initialize your data structure here.
Heap/FindMedianFromDataStream.py:115
Method__init__
(self, value, nextNode=None)
Tree/Trie.py:29
Method__init__
Initialize your data structure here.
Tree/Trie.py:50
Method__init__
:type root: TreeNode
Tree/CompleteBinaryTreeInserter.py:71
Method__init__
(self, val, left=None, right=None)
Tree/serializeAndDeserialize.py:53
Method__init__
(self , val, left=None, right=None)
Tree/BinarySearchTree.py:14
next →1–100 of 332, ranked by callers