MCPcopy Create free account

hub / github.com/Amanhacker/Aman-Barnwal-Leetcode-Solutions / functions

Functions931 in github.com/Amanhacker/Aman-Barnwal-Leetcode-Solutions

Methoddfs
2368-reachable-nodes-with-restrictions/2368-reachable-nodes-with-restrictions.cpp:4
Methoddfs
Height of a node root
543-diameter-of-binary-tree/543-diameter-of-binary-tree.cpp:16
Methoddfs
965-univalued-binary-tree/965-univalued-binary-tree.cpp:15
Methoddfs
671-second-minimum-node-in-a-binary-tree/671-second-minimum-node-in-a-binary-tree.cpp:15
Methoddfs
501-find-mode-in-binary-search-tree/501-find-mode-in-binary-search-tree.cpp:19
Methoddfs
number-of-closed-islands/number-of-closed-islands.cpp:12
Methoddfs
886-possible-bipartition/886-possible-bipartition.cpp:4
Methoddfs
947-most-stones-removed-with-same-row-or-column/947-most-stones-removed-with-same-row-or-column.cpp:4
Methoddfs
711-number-of-distinct-islands-ii/711-number-of-distinct-islands-ii.cpp:7
Methoddfs
count-sub-islands/count-sub-islands.cpp:19
Methoddfs
Here, dp[x][y] gives us the length of longest increasing path starting from (x, y)
2328-number-of-increasing-paths-in-a-grid/2328-number-of-increasing-paths-in-a-grid.cpp:18
Methoddfs
1631-path-with-minimum-effort/1631-path-with-minimum-effort.cpp:12
MethoddfsGraph
2385-amount-of-time-for-binary-tree-to-be-infected/2385-amount-of-time-for-binary-tree-to-be-infected.cpp:15
MethoddiStringMatch
942-di-string-match/942-di-string-match.cpp:4
Methoddiameter
1522-diameter-of-n-ary-tree/1522-diameter-of-n-ary-tree.cpp:58
MethoddiameterOfBinaryTree
543-diameter-of-binary-tree/543-diameter-of-binary-tree.cpp:28
MethoddietPlanPerformance
1176-diet-plan-performance/1176-diet-plan-performance.cpp:4
Methoddijkstra
1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/1334-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance.cpp:10
Methoddijkstra
1514-path-with-maximum-probability/1514-path-with-maximum-probability.cpp:4
Methoddijkstra
743-network-delay-time/743-network-delay-time.cpp:4
MethoddisplayTable
1418-display-table-of-food-orders-in-a-restaurant/1418-display-table-of-food-orders-in-a-restaurant.cpp:4
MethoddistanceK
0863-all-nodes-distance-k-in-binary-tree/0863-all-nodes-distance-k-in-binary-tree.cpp:65
MethoddistinctNumbers
1852-distinct-numbers-in-each-subarray/1852-distinct-numbers-in-each-subarray.cpp:4
MethoddistributeCoins
0979-distribute-coins-in-binary-tree/0979-distribute-coins-in-binary-tree.cpp:28
MethoddivideString
2138-divide-a-string-into-groups-of-size-k/2138-divide-a-string-into-groups-of-size-k.cpp:4
MethoddominantIndex
747-largest-number-at-least-twice-of-others/747-largest-number-at-least-twice-of-others.cpp:4
MethoddotProduct
Return the dotProduct of two sparse vectors
1570-dot-product-of-two-sparse-vectors/1570-dot-product-of-two-sparse-vectors.cpp:17
MethodeatenApples
1705-maximum-number-of-eaten-apples/1705-maximum-number-of-eaten-apples.cpp:4
MethodedgeScore
2374-node-with-highest-edge-score/2374-node-with-highest-edge-score.cpp:4
Methodencode
Encodes a URL to a shortened URL.
535-encode-and-decode-tinyurl/535-encode-and-decode-tinyurl.cpp:8
Methodencode
1256-encode-number/1256-encode-number.cpp:5
MethodequalToDescendants
1973-count-nodes-equal-to-sum-of-descendants/1973-count-nodes-equal-to-sum-of-descendants.cpp:28
MethodequationsPossible
0990-satisfiability-of-equality-equations/0990-satisfiability-of-equality-equations.cpp:24
MethodevalRPN
150-evaluate-reverse-polish-notation/150-evaluate-reverse-polish-notation.cpp:4
Methodevaluate
1628-design-an-expression-tree-with-evaluate-function/1628-design-an-expression-tree-with-evaluate-function.cpp:27
Methodevaluate
1628-design-an-expression-tree-with-evaluate-function/1628-design-an-expression-tree-with-evaluate-function.cpp:51
MethodeventualSafeNodes
find-eventual-safe-states/find-eventual-safe-states.cpp:39
MethodeventualSafeNodes
802-find-eventual-safe-states/802-find-eventual-safe-states.cpp:34
MethodexecuteInstructions
2120-execution-of-all-suffix-instructions-staying-in-a-grid/2120-execution-of-all-suffix-instructions-staying-in-a-grid.cpp:10
Methodexist
79-word-search/79-word-search.cpp:41
MethodexistHelper
79-word-search/79-word-search.cpp:15
MethodexpressiveWords
809-expressive-words/809-expressive-words.cpp:25
MethodextendPalindrome
647-palindromic-substrings/647-palindromic-substrings.cpp:4
Methodfetch
1756-design-most-recently-used-queue/1756-design-most-recently-used-queue.cpp:11
Methodfib
0509-fibonacci-number/0509-fibonacci-number.cpp:4
MethodfinalValueAfterOperations
2011-final-value-of-variable-after-performing-operations/2011-final-value-of-variable-after-performing-operations.cpp:4
Methodfind
1261-find-elements-in-a-contaminated-binary-tree/1261-find-elements-in-a-contaminated-binary-tree.cpp:42
MethodfindAllCasePermutations
784-letter-case-permutation/784-letter-case-permutation.cpp:4
MethodfindAllCombinations
1286-iterator-for-combination/1286-iterator-for-combination.cpp:7
MethodfindAllPathSum
112-path-sum/112-path-sum.cpp:15
MethodfindAllPaths
113-path-sum-ii/113-path-sum-ii.cpp:15
MethodfindAllPaths
129-sum-root-to-leaf-numbers/129-sum-root-to-leaf-numbers.cpp:28
MethodfindAllPaths
980-unique-paths-iii/980-unique-paths-iii.cpp:16
MethodfindAllPaths
257-binary-tree-paths/257-binary-tree-paths.cpp:15
MethodfindAllPermutations
1079-letter-tile-possibilities/1079-letter-tile-possibilities.cpp:4
MethodfindAllStrings
1415-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/1415-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n.cpp:6
MethodfindAllSubsets
1863-sum-of-all-subset-xor-totals/1863-sum-of-all-subset-xor-totals.cpp:4
MethodfindAnagrams
438-find-all-anagrams-in-a-string/438-find-all-anagrams-in-a-string.cpp:4
MethodfindAnagrams
0438-find-all-anagrams-in-a-string/0438-find-all-anagrams-in-a-string.cpp:4
MethodfindArea
85-maximal-rectangle/85-maximal-rectangle.cpp:4
MethodfindBottomLeftValue
513-find-bottom-left-tree-value/513-find-bottom-left-tree-value.cpp:45
MethodfindBuildings
1762-buildings-with-an-ocean-view/1762-buildings-with-an-ocean-view.cpp:4
MethodfindCenter
1791-find-center-of-star-graph/1791-find-center-of-star-graph.cpp:4
MethodfindCheapestPrice
cheapest-flights-within-k-stops/cheapest-flights-within-k-stops.cpp:30
MethodfindCircleNum
547-number-of-provinces/547-number-of-provinces.cpp:17
MethodfindClosestElements
658-find-k-closest-elements/658-find-k-closest-elements.cpp:5
MethodfindClosestLeaf
742-closest-leaf-in-a-binary-tree/742-closest-leaf-in-a-binary-tree.cpp:94
MethodfindComplement
476-number-complement/476-number-complement.cpp:4
MethodfindContentChildren
455-assign-cookies/455-assign-cookies.cpp:4
MethodfindContestMatch
544-output-contest-matches/544-output-contest-matches.cpp:4
MethodfindDiagonalOrder
498-diagonal-traverse/498-diagonal-traverse.cpp:4
MethodfindDiagonalOrder
1424-diagonal-traverse-ii/1424-diagonal-traverse-ii.cpp:4
MethodfindDist
Distance between node "node" and node having value n
1740-find-distance-in-a-binary-tree/1740-find-distance-in-a-binary-tree.cpp:16
MethodfindDistance
Find distance between node having value p and q
1740-find-distance-in-a-binary-tree/1740-find-distance-in-a-binary-tree.cpp:45
MethodfindDuplicateSubtrees
0652-find-duplicate-subtrees/0652-find-duplicate-subtrees.cpp:28
MethodfindDuplicates
442-find-all-duplicates-in-an-array/442-find-all-duplicates-in-an-array.cpp:4
MethodfindFarmland
find-all-groups-of-farmland/find-all-groups-of-farmland.cpp:30
MethodfindFinalValue
2154-keep-multiplying-found-values-by-two/2154-keep-multiplying-found-values-by-two.cpp:4
MethodfindFrequentTreeSum
0508-most-frequent-subtree-sum/0508-most-frequent-subtree-sum.cpp:42
MethodfindGCD
1979-find-greatest-common-divisor-of-array/1979-find-greatest-common-divisor-of-array.cpp:20
MethodfindJudge
997-find-the-town-judge/997-find-the-town-judge.cpp:4
MethodfindKthLargest
215-kth-largest-element-in-an-array/215-kth-largest-element-in-an-array.cpp:4
MethodfindLCA
0865-smallest-subtree-with-all-the-deepest-nodes/0865-smallest-subtree-with-all-the-deepest-nodes.cpp:42
MethodfindLCA
Find LCA of two nodes having value p and q
1740-find-distance-in-a-binary-tree/1740-find-distance-in-a-binary-tree.cpp:29
MethodfindLCA
1123-lowest-common-ancestor-of-deepest-leaves/1123-lowest-common-ancestor-of-deepest-leaves.cpp:42
MethodfindLCA
1644-lowest-common-ancestor-of-a-binary-tree-ii/1644-lowest-common-ancestor-of-a-binary-tree-ii.cpp:13
MethodfindLCA
1676-lowest-common-ancestor-of-a-binary-tree-iv/1676-lowest-common-ancestor-of-a-binary-tree-iv.cpp:15
MethodfindLUSlength
521-longest-uncommon-subsequence-i/521-longest-uncommon-subsequence-i.cpp:4
MethodfindLeaves
366-find-leaves-of-binary-tree/366-find-leaves-of-binary-tree.cpp:33
MethodfindLength
718-maximum-length-of-repeated-subarray/718-maximum-length-of-repeated-subarray.cpp:4
MethodfindLengthofLRS
Longest Repeating Subsequence - GFG/longest-repeating-subsequence.cpp:10
MethodfindLevel
Level starts from 1 from root node
111-minimum-depth-of-binary-tree/111-minimum-depth-of-binary-tree.cpp:26
MethodfindLevelOrder
637-average-of-levels-in-binary-tree/637-average-of-levels-in-binary-tree.cpp:27
MethodfindLongestChain
maximum-length-of-pair-chain/maximum-length-of-pair-chain.cpp:8
MethodfindMaxDiff
1140-stone-game-ii/1140-stone-game-ii.cpp:4
MethodfindMaxScoreAlice
1406-stone-game-iii/1406-stone-game-iii.cpp:6
MethodfindMedianSortedArrays
4-median-of-two-sorted-arrays/4-median-of-two-sorted-arrays.cpp:4
MethodfindMiddleIndex
1991-find-the-middle-index-in-array/1991-find-the-middle-index-in-array.cpp:4
MethodfindMinCost
Matrix Chain Multiplication - GFG/matrix-chain-multiplication.cpp:13
MethodfindMinHeightTrees
310-minimum-height-trees/310-minimum-height-trees.cpp:40
← previousnext →301–400 of 931, ranked by callers