Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/MAZHARMIK/Interview_DS_Algo
/ functions
Functions
3,557 in github.com/MAZHARMIK/Interview_DS_Algo
⨍
Functions
3,557
◇
Types & classes
1,501
↓ 2 callers
Function
getNSL
Stack/Sum of Subarray Minimums.cpp:167
↓ 2 callers
Function
getNSR
Stack/Sum of Subarray Minimums.cpp:183
↓ 2 callers
Function
getNode
Trie/Counting Words With a Given Prefix.cpp:36
↓ 2 callers
Function
getPrice
Define a long long type in Java
Bit_Magic/Maximum Number That Sum of the Prices Is Less Than or Equal to K.cpp:123
↓ 2 callers
Function
getRightMax
Arrays/Trapping Rain Water (without stack).cpp:59
↓ 2 callers
Function
hasCommon
DP/Maximum Length of a Concatenated String with Unique Characters.cpp:76
↓ 2 callers
Function
insert
Bit_Magic/Maximum XOR of Two Numbers in an Array.cpp:83
↓ 2 callers
Method
insert
Trie/Counting Words With a Given Prefix.cpp:55
↓ 2 callers
Function
insertInSet
Insert updated pair
Sliding Window/Find X-Sum of All K-Long Subarrays II.cpp:132
↓ 2 callers
Function
isGood
Arrays/Leetcode Easy/Check if Array is Good.cpp:122
↓ 2 callers
Function
isPrime
Mathematical/Closest Prime Numbers in Range.cpp:160
↓ 2 callers
Function
isVowel
strings/Count Beautiful Substrings I.cpp:48
↓ 2 callers
Function
kInversePairs
DP/K Inverse Pairs Array.cpp:211
↓ 2 callers
Function
kthCharacter
strings/Easy Tagged/Find the K-th Character in String Game I.cpp:73
↓ 2 callers
Function
kthGrammar
Recursion/K-th Symbol in Grammar.cpp:34
↓ 2 callers
Function
lastOccur
Arrays/Element Appearing More Than 25% In Sorted Array.cpp:197
↓ 2 callers
Function
lengthLinkedList
Linked List/Remove Nth Node From End of List.cpp:86
↓ 2 callers
Function
lis
DP/LIS & Variants/Longest Increasing Subsequence.cpp:17
↓ 2 callers
Function
longestPrefixSuffix
Arrays/Number of Subarrays That Match a Pattern I and II.cpp:164
↓ 2 callers
Function
lowerBound
Custom implementation of lower bound
Arrays/Leetcode Easy/Special Array With X Elements Greater Than or Equal X.cpp:160
↓ 2 callers
Method
maxSize
Graph/Disjoint Set/Greatest Common Divisor Traversal.cpp:57
↓ 2 callers
Function
maxXor
Bit_Magic/Maximum XOR of Two Numbers in an Array.cpp:106
↓ 2 callers
Method
merge
Recursion/Merge Sort.cpp:15
↓ 2 callers
Function
minKey
Approach-2 :Without using Priority_queue
Graph/Minimum Spanning Tree (Prim's).cpp:53
↓ 2 callers
Function
nCr
Compute nCr % MOD
DP/Digit DP/Find Sum of Array Product of Magical Sequences.cpp:209
↓ 2 callers
Method
next
Design/Flatten Nested List Iterator.cpp:24
↓ 2 callers
Function
operate
Stack/Evaluate Reverse Polish Notation.cpp:92
↓ 2 callers
Function
partition_algo
Heap/Kth Largest Element in an Array.cpp:141
↓ 2 callers
Method
pop
Removes the element on top of the stack and returns that element. */
Design/Implement Stack using Queues.cpp:27
↓ 2 callers
Function
possibleToPlace
Arrays/Binary Search/Magnetic Force Between Two Balls.cpp:67
↓ 2 callers
Function
preprocess
Preprocess to mark prerequisites for each node
Graph/Topological Sorting/Course Schedule IV.cpp:254
↓ 2 callers
Function
removeFromSet
Sliding Window/Find X-Sum of All K-Long Subarrays II.cpp:125
↓ 2 callers
Function
reverseRow
Helper method to reverse a row
Arrays/2-D Array/Rotating the Box.cpp:219
↓ 2 callers
Function
searchKMP
strings/Easy Tagged/String Matching in an Array.cpp:175
↓ 2 callers
Method
searchPrefixCount
Trie/Counting Words With a Given Prefix.cpp:70
↓ 2 callers
Method
setSize
Graph/Disjoint Set/Maximum Number of Fish in a Grid.cpp:54
↓ 2 callers
Function
solve
DP/Check if There is a Valid Partition For The Array.cpp:15
↓ 2 callers
Function
sortFunc
Sorting to give priority to the char which has the highest frequency Because I would want it to come first in any button (key)
HashMap/Minimum Number of Pushes to Type Word II.cpp:96
↓ 2 callers
Method
startsWith
Returns if there is any word in the trie that starts with the given prefix. */
Trie/Implement Trie (Prefix Tree).cpp:69
↓ 2 callers
Function
subsetSum
DP/Partition Equal Subset Sum.cpp:166
↓ 2 callers
Function
tree2str
Recursion/Construct String from Binary Tree.cpp:40
↓ 2 callers
Function
union
Graph/BFS_DFS/Making A Large Island.cpp:500
↓ 2 callers
Method
union
Graph/Disjoint Set/Greatest Common Divisor Traversal.cpp:128
↓ 2 callers
Function
unsetBit
Bit_Magic/Minimize XOR.cpp:167
↓ 1 callers
Function
KadanesAlgo
DP/Maximum Sum Rectangular Submatrix in Matrix dynamic programming(2-D kadane).cpp:17
↓ 1 callers
Function
LCSubstring
DP/Print the Longest Common Substring.cpp:11
↓ 1 callers
Method
Union
Graph/Redundant Connection.cpp:135
↓ 1 callers
Method
Union
Graph/BFS_DFS/Making A Large Island.cpp:216
↓ 1 callers
Method
Union
this is the trick, we return size of group after uniting the nodes in a group Union by rank compression
Graph/Disjoint Set/Max Area of Island.cpp:35
↓ 1 callers
Method
Union
Graph/Disjoint Set/Maximum Number of Fish in a Grid.cpp:37
↓ 1 callers
Method
Union
Graph/Disjoint Set/Count the Number of Complete Components.cpp:142
↓ 1 callers
Function
binarySearch
DP/LIS & Variants/Longest Increasing Subsequence.cpp:255
↓ 1 callers
Function
binarySearchLowerBound
Arrays/Binary Search/Number of Flowers in Full Bloom.cpp:153
↓ 1 callers
Function
binarySearchUpperBound
Arrays/Binary Search/Number of Flowers in Full Bloom.cpp:134
↓ 1 callers
Function
bottomUp1
DP/Decode Ways.cpp:183
↓ 1 callers
Function
bottomUp2
DP/Decode Ways.cpp:213
↓ 1 callers
Function
comparator
Arrays/Sort Array By Parity.cpp:67
↓ 1 callers
Function
comparePairs
Helper comparison to mimic pair comparison from C++
Sliding Window/Find X-Sum of All K-Long Subarrays II.cpp:196
↓ 1 callers
Method
compareTo
Design/Design Movie Rental System.cpp:120
↓ 1 callers
Function
countOperations
Mathematical/Leetcode Easy/Count Operations to Obtain Zero.cpp:82
↓ 1 callers
Function
createUtil
Tree/Construct_Binary_Tree_from_Parent_Array.cpp:6
↓ 1 callers
Function
cutRod_bottom_up_I
Unbounded Knapsack (Bottom Up)
DP/Cutting_a_Rod.cpp:40
↓ 1 callers
Function
cutRod_bottom_up_II
Bottom UP
DP/Cutting_a_Rod.cpp:64
↓ 1 callers
Function
cutRod_memoization_I
Memoized Approach (Top Down)
DP/Cutting_a_Rod.cpp:11
↓ 1 callers
Function
cutRod_memoization_II
Memoized Approach (Top Down) - Just Like 0/1 Unbounded Knapsack
DP/Cutting_a_Rod.cpp:26
↓ 1 callers
Function
dfs
HashMap/Restore the Array From Adjacent Pairs.cpp:85
↓ 1 callers
Function
diagonalPrint
Tree/Diagonal Tree Traversal (Recursive: using map).cpp:32
↓ 1 callers
Function
diagonalUtil
Tree/Diagonal Tree Traversal (Recursive: using map).cpp:23
↓ 1 callers
Method
find
Graph/BFS_DFS/Power Grid Maintenance.cpp:409
↓ 1 callers
Method
find
Greedy/Minimum Domino Rotations For Equal Row.cpp:16
↓ 1 callers
Method
findMaximumXOR
Bit_Magic/Maximum XOR of Two Numbers in an Array.cpp:63
↓ 1 callers
Function
findUpperBound
Arrays/Intervals_Based_Qn/Maximum Beauty of an Array After Applying Operation.cpp:143
↓ 1 callers
Method
getAncestors
Graph/All Ancestors of a Node in a Directed Acyclic Graph.cpp:27
↓ 1 callers
Method
getGroupSize
Graph/Disjoint Set/Max Area of Island.cpp:58
↓ 1 callers
Method
getValue
Heap/Maximum Total Subarray Value II.cpp:76
↓ 1 callers
Method
insert
Trie/Find the Length of the Longest Common Prefix.cpp:65
↓ 1 callers
Function
insertGreatestCommonDivisors
Linked List/Insert Greatest Common Divisors in Linked List.cpp:118
↓ 1 callers
Function
isCycleUtil
Graph/Detect cycle in an undirected graph (DFS).cpp:6
↓ 1 callers
Function
isCyclicUtil
Using Parent vector
Graph/Detect cycle in an undirected graph (BFS).cpp:51
↓ 1 callers
Function
isPalindrome
strings/Easy Tagged/Find First Palindromic String in the Array.cpp:81
↓ 1 callers
Function
isPowerOfThree
Mathematical/Leetcode Easy/Power of Three.cpp:15
↓ 1 callers
Function
isPowerOfTwo
Bit_Magic/Leetcode Easy/Power of Two.cpp:55
↓ 1 callers
Function
isReachableAtTime
Mathematical/Determine if a Cell Is Reachable at a Given Time.cpp:58
↓ 1 callers
Method
isReachableAtTime
Mathematical/Determine if a Cell Is Reachable at a Given Time.cpp:13
↓ 1 callers
Function
isSubsequence
strings/Is Subsequence.cpp:74
↓ 1 callers
Function
isUnSet
Bit_Magic/Minimize XOR.cpp:171
↓ 1 callers
Function
lis
DP/LIS & Variants/Maximum Length of Pair Chain.cpp:21
↓ 1 callers
Function
lowerBound
Function to find the lower_bound of an element in a sorted list
strings/Find Beautiful Indices in the Given Array I.cpp:165
↓ 1 callers
Function
lowerBound
Function to find the lower_bound of an element in a sorted list
strings/Find Beautiful Indices in the Given Array II.cpp:167
↓ 1 callers
Function
lowerBound
Custom lower_bound (first index >= target)
Arrays/Binary Search/Maximize the Distance Between Points on a Square.cpp:259
↓ 1 callers
Function
maxLength
DP/Maximum Length of a Concatenated String with Unique Characters.cpp:72
↓ 1 callers
Function
maxScoreUtilBottomUp
DP/Jump Game VI.cpp:49
↓ 1 callers
Function
maxSeg1
APPROACH-1 (Using Simple Maths)
DP/Maximize The Cut Segments (5 approaches).cpp:12
↓ 1 callers
Function
maxSeg2
APPROACH-2 (Usin concept of Coin Change)
DP/Maximize The Cut Segments (5 approaches).cpp:30
↓ 1 callers
Function
maxSeg3
APPROACH-3 (Bottom Up DP)
DP/Maximize The Cut Segments (5 approaches).cpp:60
↓ 1 callers
Function
maxSeg4
APPROACH-4 (Using recursion with Memoization)
DP/Maximize The Cut Segments (5 approaches).cpp:78
↓ 1 callers
Function
maxSeg5
APPROACH-5 (Using concept of Rod Cutting)
DP/Maximize The Cut Segments (5 approaches).cpp:93
↓ 1 callers
Method
merge
Arrays/Intervals_Based_Qn/Merge Intervals.cpp:15
↓ 1 callers
Function
mergeNodes
Linked List/Merge Nodes in Between Zeros.cpp:93
↓ 1 callers
Function
next
Design/Flatten Nested List Iterator.cpp:140
← previous
next →
301–400 of 3,557, ranked by callers