MCPcopy Create free account

hub / github.com/Hsinha11/Leetcode-solutions / functions

Functions798 in github.com/Hsinha11/Leetcode-solutions

MethodcloneGraph
(Node node)
133-clone-graph/clone-graph.java:23
MethodcloneGraph
(self, node: 'Node')
133-clone-graph/clone-graph.py:12
FunctioncoinChange
(coins, amount)
322-coin-change/coin-change.js:8
MethodcoinChange
(int[] coins, int amount)
322_Coin_Change/322_Coin_Change.java:2
MethodcoinChange
(self, coins: List[int], amount: int)
322-coin-change/coin-change.py:6
MethodcoinChange
(int[] coins, int amount)
322-coin-change/coin-change.java:6
MethodcoloredCells
(self, n: int)
2579-Count-Total-Number-of-Colored-Cells/Count-Total-Number-of-Colored-Cells.py:2
Methodcomb
(i,n,k,l,c)
77-combinations/combinations.py:6
Methodcomb
77-combinations/combinations.cpp:3
FunctioncombinationSum
(candidates, target)
39-combination-sum/combination-sum.js:8
MethodcombinationSum
(int[] candidates, int target)
39-combination-sum/combination-sum.java:6
MethodcombinationSum
(self, candidates: List[int], target: int)
39-combination-sum/combination-sum.py:6
MethodcombinationSum3
(self, k: int, n: int)
-216-Combination-Sum-III/Approach2.py:4
MethodcombinationSum3
(self, k: int, n: int)
-216-Combination-Sum-III/Approach1.py:4
Methodcombine
(self, n: int, k: int)
77-combinations/combinations.py:2
Methodcombine
77-combinations/combinations.cpp:14
MethodcommonChars
(self, A: List[str])
1044-find-common-characters/find-common-characters.py:2
MethodcompareVersion
(self, version1, version2)
165-compare-version-numbers/compare-version-numbers.py:2
MethodcompletePrime
(self, num: int)
4100-complete-prime-number/complete-prime-number.py:16
MethodconcatWithReverse
(self, nums: list[int])
4299-concatenate-array-with-reverse/concatenate-array-with-reverse.py:2
FunctioncontainsDuplicate
(nums)
217-contains-duplicate/contains-duplicate.js:7
MethodcontainsDuplicate
(int[] nums)
217-contains-duplicate/contains-duplicate.java:7
MethodcontainsDuplicate
(self, nums: List[int])
217-contains-duplicate/contains-duplicate.py:6
Functionconvert
(s: str, numRows: int)
6.Zigzag-Conversion/zigzag-conversion.py:1
FunctioncountBits
(n)
338-counting-bits/counting-bits.js:7
MethodcountBits
(self, n: int)
338-counting-bits/counting-bits.py:6
MethodcountBits
(int n)
338-counting-bits/counting-bits.java:4
MethodcountConsistentStrings
(self, a: str, w: List[str])
1786-count-the-number-of-consistent-strings/count-the-number-of-consistent-strings.py:2
MethodcountElements
(self, nums: List[int], k: int)
4141-count-elements-with-at-least-k-greater-values/count-elements-with-at-least-k-greater-values.py:2
MethodcountHillValley
(self, nums: List[int])
2316-count-hills-and-valleys-in-an-array/count-hills-and-valleys-in-an-array.py:2
MethodcountMaxOrSubsets
(self, nums: List[int])
2170-count-number-of-maximum-bitwise-or-subsets/count-number-of-maximum-bitwise-or-subsets.py:2
MethodcountMaxOrSubsets
2044-count-number-of-maximum-bitwise-OR-subsets/count_number_of_maximum_bitwise_OR_subsets.cpp:17
MethodcountNodes
(self, root: Optional[TreeNode])
222-count-complete-tree-nodes/count-complete-tree-nodes.py:8
MethodcountOdds
(self, low: int, high: int)
1630-count-odd-numbers-in-an-interval-range/count-odd-numbers-in-an-interval-range.py:2
MethodcountOperations
(self, num1: int, num2: int)
2288-count-operations-to-obtain-zero/count-operations-to-obtain-zero.py:2
MethodcountPairs
2917-count-pairs-whose-sum-is-less-than-target/count-pairs-whose-sum-is-less-than-target.cpp:3
MethodcountPairs
(self, nums: List[int], k: int)
2277-count-equal-and-divisible-pairs-in-an-array/count-equal-and-divisible-pairs-in-an-array.py:2
MethodcountPartitions
(self, l: List[int])
3704-count-partitions-with-even-sum-difference/count-partitions-with-even-sum-difference.py:2
MethodcountPoints
(self, points: List[List[int]], queries: List[List[int]])
1939-queries-on-number-of-points-inside-a-circle/queries-on-number-of-points-inside-a-circle.py:2
FunctioncountSubstrings
(s)
647-palindromic-substrings/palindromic-substrings.js:7
MethodcountSubstrings
(String s)
647-palindromic-substrings/palindromic-substrings.java:4
MethodcountSubstrings
(self, s: str)
647-palindromic-substrings/palindromic-substrings.py:4
MethodcountTriples
(self, n: int)
2037-count-square-sum-triples/count-square-sum-triples.py:2
MethodcountUnguarded
(self, m: int, n: int, g: list[list[int]], w: list[list[int]])
2343-count-unguarded-cells-in-the-grid/count-unguarded-cells-in-the-grid.py:2
MethodcountValidSelections
(self, nums: List[int])
3616-make-array-elements-equal-to-zero/make-array-elements-equal-to-zero.py:2
Functioncount_of_integers
2719-count-of-integers/2719-count-of-integers.cpp:63
MethodcreateBinaryTree
(self, descr: List[List[int]])
2306-create-binary-tree-from-descriptions/create-binary-tree-from-descriptions.py:8
MethodcycleLengthQueries
2509-cycle-length-queries-in-a-tree/2509-cycle-length-queries-in-a-tree.cpp:10
Functiondebounce
(fn, t)
2743-debounce/debounce.js:6
Methoddecode
Decodes a shortened URL to its original URL. Time Complexity: O(1) average
535-encode-and-decode-TinyURL /EncodeAndDecodeTinyUrl.java:69
MethoddelNodes
(self, root, to_delete)
-1110-Delete Nodes and Return Forest/Delete Nodes and Return Forest.py:21
MethoddeleteAndEarn
(self, nums: List[int])
740-delete-and-earn/delete-and-earn.py:2
MethoddeleteAtIndex
(self, index: int)
838-design-linked-list/design-linked-list.py:25
MethoddeleteDuplicates
Remove Duplicates from Sorted List II/Remove Duplicates from Sorted List II.cpp:13
MethoddeleteFront
Function to delete the front element
641-design-circular-deque/design-circular-deque.cpp:56
MethoddeleteLast
Function to delete the last element
641-design-circular-deque/design-circular-deque.cpp:72
MethoddeleteNode
(self, node: 'ListNode')
237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.py:21
MethoddeleteNode
237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.cpp:21
Methoddeposit
(self, account: int, money: int)
2169-simple-bank-system/simple-bank-system.py:18
Methoddepth
(root)
1218-lowest-common-ancestor-of-deepest-leaves/lowest-common-ancestor-of-deepest-leaves.py:10
Methoddepth
(root)
896-smallest-subtree-with-all-the-deepest-nodes/smallest-subtree-with-all-the-deepest-nodes.py:9
Methoddeserialize
Decodes your encoded data to tree. :type data: str :rtype: TreeNode
297-serialize-and-deserialize-binary-tree/serialize-and-deserialize-binary-tree.py:27
Methoddeserialize
(self, data: str)
449-serialize-and-deserialize-bst/serialize-and-deserialize-bst.py:30
Methoddfs
(root)
1243-sum-of-nodes-with-even-valued-grandparent/sum-of-nodes-with-even-valued-grandparent.py:11
Methoddfs
(n, r, c)
427-Construct-Quad-Tree/427_Construct_quad_tree.py:14
Methoddfs
2719-count-of-integers/2719-count-of-integers.cpp:24
Methoddfs
(node)
547-number-of-provinces/number-of-provinces.py:3
Methoddfs
(i, j, l, lst)
-216-Combination-Sum-III/Approach2.py:7
Methoddfs
(i, res, last)
3453-generate-binary-strings-without-adjacent-zeros/generate-binary-strings-without-adjacent-zeros.py:5
Methoddfs
(l,r)
101-symmetric-tree/symmetric-tree.py:11
Methoddfs
(node: Optional[TreeNode])
968-binary-tree-cameras/binary-tree-cameras.py:12
Methoddfs
(root)
653-two-sum-iv-input-is-a-bst/two-sum-iv-input-is-a-bst.py:10
Methoddfs
(original)
133-clone-graph/clone-graph.py:18
MethoddifferenceOfSums
(self, n: int, m: int)
3172-divisible-and-non-divisible-sums-difference/divisible-and-non-divisible-sums-difference.py:2
MethoddistinctAverages
(self, nums: List[int])
2561-number-of-distinct-averages/number-of-distinct-averages.py:2
MethoddistributeCandies
(self, candyType)
-575-Distribute_Candies/575-distribute-candies.py:2
MethoddistributeCoins
1021-distribute-coins-in-binary-tree/distribute-coins-in-binary-tree.cpp:27
MethoddistributeCoins
(self, root: Optional[TreeNode])
1021-distribute-coins-in-binary-tree/distribute-coins-in-binary-tree.py:13
Methoddivide
29-Divide-two-Integers/29-Divide-two-Integers.cpp:6
MethoddivideArray
2308-divide-array-into-equal-pairs/divide-array-into-equal-pairs.cpp:3
Methoddp
Returns the minimum cost to cover travel from days[i] to end.
983-minimum-cost-for-tickets/983-minimum-cost-for-tickets.py:14
Methodencode
Encodes a URL to a shortened URL. Time Complexity: O(1) average
535-encode-and-decode-TinyURL /EncodeAndDecodeTinyUrl.java:50
FunctioneraseOverlapIntervals
(intervals)
435-non-overlapping-intervals/non-overlapping-intervals.js:7
MethoderaseOverlapIntervals
(int[][] intervals)
435-non-overlapping-intervals/non-overlapping-intervals.java:6
MethoderaseOverlapIntervals
(self, intervals: List[List[int]])
435-non-overlapping-intervals/non-overlapping-intervals.py:6
MethodevalRPN
(self, tokens: List[str])
150-evaluate-reverse-polish-notation/evaluate-reverse-polish-notation.py:2
Functionexist
(board, word)
79-word-search/word-search.js:6
Methodexist
(char[][] board, String word)
79-word-search/word-search.java:5
Methodf
(r,k)
514-freedom-trail/freedom-trail.py:21
Methodf
(root,h)
1218-lowest-common-ancestor-of-deepest-leaves/lowest-common-ancestor-of-deepest-leaves.py:16
Methodf
(index,curr)
1388-greatest-sum-divisible-by-three/greatest-sum-divisible-by-three.py:6
Methodf
(root,h)
896-smallest-subtree-with-all-the-deepest-nodes/smallest-subtree-with-all-the-deepest-nodes.py:15
Methodf
(root)
775-n-ary-tree-preorder-traversal/n-ary-tree-preorder-traversal.py:12
Methodfib
509. Fibonacci/509.fibonacci.cpp:4
MethodfindCheapestPrice
(int n, int[][] flights, int src, int dst, int k)
-787-Cheapest Flights Within K Stops/Code.java:2
MethodfindCheapestPrice
-787-Cheapest Flights Within K Stops/Code.cpp:3
MethodfindCheapestPrice
(self, n, flights, src, dst, k)
-787-Cheapest Flights Within K Stops/Code.py:4
MethodfindCircleNum
(self, mat: List[List[int]])
547-number-of-provinces/number-of-provinces.py:2
MethodfindClosest
(self, x: int, y: int, z: int)
3830-find-closest-person/find-closest-person.py:2
MethodfindCoins
3592-inverse-coin-change/inverse-coin-change.cpp:4
← previousnext →201–300 of 798, ranked by callers