MCPcopy Create free account

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

Functions798 in github.com/Hsinha11/Leetcode-solutions

↓ 1 callersMethodisSubtree
(self, root: TreeNode, subRoot: TreeNode)
-572-subtree-of-another-tree/-572-subtree-of-another-tree.py:9
↓ 1 callersMethodisTwo
(self, n: str)
900-reordered-power-of-2/reordered-power-of-2.py:2
↓ 1 callersMethodmaxPerformance
(self, n: int, speed: List[int], efficiency: List[int], k: int)
1383-Maximum-Performance-of-a-Team/Maximum-Performance-of-a-Team.py:5
↓ 1 callersMethodmaximumInvitations
-2127-Maximum-Employee-to-be-invited-to-a-meeting/Maximum_Employee.cpp:6
↓ 1 callersMethodmergeMinSumPair
(int[] nums)
3507-minimum-pair-removal-to-sort-array-i/Solution.java:21
↓ 1 callersMethodminimumHammingDistance
MinimizeHammingDistance/MinimizeHammingDistance.cpp:33
↓ 1 callersMethodmoveZeroes
Alternative two-pass approach (less optimal but easier to understand). Pass 1: Move all non-zero elements to front P
283-move-zeroes/move-zeroes.py:55
↓ 1 callersMethodmoveZeroes
'Snowball' approach - imagine zeros rolling like a snowball. Track the size of the 'snowball' (consecutive zeros). W
283-move-zeroes/move-zeroes.py:76
↓ 1 callersMethodorangesRotting
994-Rotting-Oranges/Rotting-Oranges.cpp:13
↓ 1 callersMethodpacificAtlantic
417-PacificAtlanticWaterFlow/417-PacificAtlanticWaterFlow.cpp:6
↓ 1 callersMethodpacificAtlantic
(int[][] heights)
417-PacificAtlanticWaterFlow/417-PacificAtlanticWaterFlow.java:4
↓ 1 callersMethodpartition
(self, s: str)
131-Palindrome-Partitioning/palindromeparitioning.py:4
↓ 1 callersFunctionprintQuadTree
(node, level=0)
427-Construct-Quad-Tree/427_Construct_quad_tree.py:36
↓ 1 callersMethodsolve
(int[][] board, int n, int col, List<String> v, List<List<String>> ans)
-51-N_Queens/Code.java:46
↓ 1 callersMethodsolve
(self, board, n, col, v, ans)
-51-N_Queens/Code.py:36
↓ 1 callersMethodswap
(int[][] matrix)
48-rotate-image/48-rotate-image.java:2
↓ 1 callersFunctiontest_solution
Comprehensive test cases for moveZeroes function.
283-move-zeroes/move-zeroes.py:95
↓ 1 callersFunctiontest_solution
Test the solution with provided examples.
2965-Find_Missing_And_Repeated_Value/find-missing-and-repeated-values.py:49
↓ 1 callersFunctiontest_solution
Test cases for the removeDuplicates function.
26-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.py:84
↓ 1 callersFunctiontest_solution
Test the solution with provided examples.
1903-largest-odd-number-in-string/largest-odd-number-in-string.py:53
↓ 1 callersMethodtopKFrequent
(self, nums: List[int], k: int)
3610-find-x-sum-of-all-k-long-subarrays-i/find-x-sum-of-all-k-long-subarrays-i.py:2
↓ 1 callersFunctiontrap
(height)
-42-Trapping-Rainwater/Tapping_Rainwater.py:1
↓ 1 callersMethodunite
MinimizeHammingDistance/MinimizeHammingDistance.cpp:19
↓ 1 callersMethodunite
1202-smallest-string-with-swaps/1202-smallest-string-with-swaps.cpp:22
MethodBookMyShow
2286-booking-concert-tickets-in-groups/2286-booking-concert-tickets-in-groups.cpp:21
MethodCodec
Initializes the object of the system.
535-encode-and-decode-TinyURL /EncodeAndDecodeTinyUrl.java:23
MethodDSU
MinimizeHammingDistance/MinimizeHammingDistance.cpp:10
MethodDSU
1202-smallest-string-with-swaps/1202-smallest-string-with-swaps.cpp:14
MethodDigitDP
2719-count-of-integers/2719-count-of-integers.cpp:20
MethodListNode
369-plus-one-linked-list/369-plus-one-linked-list.cpp:11
MethodMyCircularDeque
Constructor to initialize the deque with size k
641-design-circular-deque/design-circular-deque.cpp:12
MethodNode
()
133-clone-graph/clone-graph.java:8
MethodSolution
237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.cpp:16
MethodTreeNode
951-flip-equivalent-binary-trees/951-flip-equivalent-binary-trees.cpp:12
Method__init__
(self, val, isLeaf, topLeft=None, topRight=None, bottomLeft=None, bottomRight=None)
427-Construct-Quad-Tree/427_Construct_quad_tree.py:3
Method__init__
(self, nums: List[int])
303-Range_Sum_Query/Range_Sum_Query.py:4
Method__init__
(self, val=0, left=None, right=None)
-1110-Delete Nodes and Return Forest/Delete Nodes and Return Forest.py:2
Method__init__
(self)
-1110-Delete Nodes and Return Forest/Delete Nodes and Return Forest.py:8
Method__init__
(self, nums: List[int])
303-range-sum-query-immutable/range-sum-query-immutable.py:3
Method__init__
(self, val=0, left=None, right=None)
-572-subtree-of-another-tree/-572-subtree-of-another-tree.py:3
Method__init__
(self, foods: List[str], cuisines: List[str], ratings: List[int])
2429-design-a-food-rating-system/design-a-food-rating-system.py:3
Method__init__
(self, balance: List[int])
2169-simple-bank-system/simple-bank-system.py:3
Method__init__
(self, val=0, left=None, right=None)
-543-Diameter-of-Binary-Tree/-543-Diameter-of-Binary-Tree.py:3
Method__init__
(self)
381-insert-delete-getrandom-o1-duplicates-allowed/insert-delete-getrandom-o1-duplicates-allowed.py:5
Method__init__
(self)
838-design-linked-list/design-linked-list.py:3
Method__init__
(self, val: int = 0, left: Optional['TreeNode'] = None, right: Optional['TreeNode'] = None)
1021-distribute-coins-in-binary-tree/distribute-coins-in-binary-tree.py:6
Method__init__
(self, height, row, col)
407_Trapping_Rain_Water_II/407.Trapping_Rain_Water_II.py:4
Method__init__
(self)
295-find-median-from-data-stream/find-median-from-data-stream.py:3
Method__lt__
(self, other)
407_Trapping_Rain_Water_II/407.Trapping_Rain_Water_II.py:10
MethodaddAtHead
(self, val: int)
838-design-linked-list/design-linked-list.py:13
MethodaddAtIndex
(self, index: int, val: int)
838-design-linked-list/design-linked-list.py:20
MethodaddAtTail
(self, val: int)
838-design-linked-list/design-linked-list.py:16
MethodaddNum
(self, num: int)
295-find-median-from-data-stream/find-median-from-data-stream.py:7
MethodaddOperators
(self, num: str, target: int)
282-expression-and-operators/expression_and_operators.py:4
MethodaddSol
-51-N_Queens/Code.cpp:19
MethodaddSpaces
-68-Text_Justification/Code.cpp:6
MethodaddTwoNumbers
:type l1: Optional[ListNode] :type l2: Optional[ListNode] :rtype: Optional[ListNode]
-2-Add_Two_Number/-2-Add_Two_Numbers.py:8
MethodappendCharacters
(self, s: str, t: str)
2572-append-characters-to-string-to-make-subsequence/append-characters-to-string-to-make-subsequence.py:2
MethodapplyOperations
(self, nums: List[int])
2551-apply-operations-to-an-array/apply-operations-to-an-array.py:2
MethodarrayChange
(self, nums: List[int], op: List[List[int]])
2388-replace-elements-in-an-array/replace-elements-in-an-array.py:2
MethodassignEdgeWeights
(self, edges: List[List[int]])
3844-number-of-ways-to-assign-edge-weights-i/number-of-ways-to-assign-edge-weights-i.py:2
MethodasteroidCollision
(self, asteroids: List[int])
735-asteroid-collision/asteroid-collision.py:2
MethodasteroidsDestroyed
(self, mass: int, ast: List[int])
2245-destroying-asteroids/destroying-asteroids.py:2
MethodasteroidsDestroyed
2245-destroying-asteroids/destroying-asteroids.cpp:3
MethodatMostKDistinct
Helper function: count subarrays with at most K distinct integers
992-Subarrays-with-K-Different-Integers/Subarrays-with-K-Different-Integers.cpp:14
MethodaverageOfLevels
(self, root: Optional[TreeNode])
637-average-of-levels-in-binary-tree/average-of-levels-in-binary-tree.py:8
Methodbacktrack
(start)
131-Palindrome-Partitioning/palindromeparitioning.py:8
Methodbacktrack
22-generate-parentheses/generate-parentheses.cpp:14
Methodbacktrack
(ind,prev,value,exp)
282-expression-and-operators/expression_and_operators.py:7
Methodbacktrack
2044-count-number-of-maximum-bitwise-OR-subsets/count_number_of_maximum_bitwise_OR_subsets.cpp:4
Methodbacktrack
(temp: List[int], remain: int, start: int)
39-combination-sum/combination-sum.py:9
Methodbfs
Return longest arm of x.
-2127-Maximum-Employee-to-be-invited-to-a-meeting/Maximum_Employee.py:7
Methodbuild
(min_val: int, max_val: int)
449-serialize-and-deserialize-bst/serialize-and-deserialize-bst.py:37
Methodcan
(target: int)
2528-Maximize-the-Minimum-Powered-City/2528-Maximize-the-Minimum-Powered-City.py:19
FunctioncanAttendMeetings
(intervals)
252-meeting-rooms/meeting-rooms.js:7
MethodcanAttendMeetings
(int[][] intervals)
252-meeting-rooms/meeting-rooms.java:6
MethodcanAttendMeetings
(self, intervals: List[List[int]])
252-meeting-rooms/meeting-rooms.py:6
MethodcanBeEqual
(self, target: List[int], arr: List[int])
1556-make-two-arrays-equal-by-reversing-subarrays/make-two-arrays-equal-by-reversing-subarrays.py:2
MethodcanBeTypedWords
(self, text: str, lett: str)
1264-maximum-number-of-words-you-can-type/maximum-number-of-words-you-can-type.py:2
MethodcanConstruct
(self, s: str, k: int)
1502-construct-k-palindrome-strings/construct-k-palindrome-strings.py:2
MethodcanConstruct
(self, ransomNote: str, magazine: str)
383-Ransom-Note/Ransom-Note.py:2
FunctioncanFinish
(numCourses, prerequisites)
207-course-schedule/course-schedule.js:8
MethodcanFinish
(self, numCourses: int, prerequisites: List[List[int]])
207-course-schedule/course-schedule.py:7
MethodcanFinish
(int numCourses, int[][] prerequisites)
207-course-schedule/course-schedule.java:6
FunctioncanJump
(nums)
55-jump-game/jump-game.js:7
MethodcanJump
(int[] nums)
55-jump-game/jump-game.java:4
MethodcanJump
(self, nums: List[int])
55-jump-game/jump-game.py:6
Methodcandy
(self, ratings: List[int])
135-candy/candy.py:2
MethodchangeRating
(self, food: str, newRating: int)
2429-design-a-food-rating-system/design-a-food-rating-system.py:24
MethodcharacterReplacement
(self, s: str, k: int)
424-longest-repeating-character-replacement/longest-repeating-character-replacement.py:2
Methodcheck
1752. Check if Array is Sorted and Rotated/1752. sortedarray.cpp:4
MethodcheckAdjacentIncreasingSubarrays
3349-adjacent-increasing-subarrays-detection-i/3349-adjacent-increasing-subarrays-detection-i.cpp:11
MethodcheckIfExist
1468-check-if-n-and-its-double-exist/check-if-n-and-its-double-exist.cpp:8
MethodcheckIfExist
(self, arr: List[int])
1468-check-if-n-and-its-double-exist/check-if-n-and-its-double-exist.py:18
MethodcheckValidString
(self, s: str)
678-valid-parenthesis-string/valid-parenthesis-string.py:2
MethodcheckValidString
678-valid-parenthesis-string/valid-parenthesis-string.cpp:3
FunctionclimbStairs
(n)
70-climbing-stairs/climbing-stairs.js:7
MethodclimbStairs
(int n)
70-climbing-stairs/climbing-stairs.java:4
MethodclimbStairs
(self, n: int)
70-climbing-stairs/climbing-stairs.py:4
FunctioncloneGraph
(node)
133-clone-graph/clone-graph.js:15
← previousnext →101–200 of 798, ranked by callers