DSA Mentorship Repository for reference
- Practice Questions:
- Find 2 elements with given sum
- Majority Element
- Find the number occuring odd number of times
- Merge an array of size n into another of size m + n
- Rotate an array
- Leaders in an array
- Majority element in sorted array
- Segregate 0s and 1s in an array
- Product array
- Find 2 repeating elements
- Find duplicates in O(n) time and O(1) space
- Linked list vs Array
- Find the smallest missing number
- Find max j-i such that arr[j] > arr[i]
- Find subarray with given sum
- Find the smallest positive number missing from an unsorted array
- Find 2 numbers with odd occurence
- Largest subarray with equal number of 0s and 1s
- Replace every element with the greatest on right side
- Stock buy sell to maximize profit
- Find common elements in 3 sorted arrays
- Nuts and bolts problem
- Trapping rain water
- Merge 2 sorted arrays in O(1) space
- Practice Questions:
- Remove duplicates from string
- Remove characters from the first string which are present in the second string
- Check if strings are rotations of each other
- Print all permutations of a given string
- Reverse words in a given string
- Find the smallest window in a string containing all the characters of the second string
- Check whether two strings are anagrams of each other
- Write your own atoi()
- Rearrange a string so that similar characters become d distance away
- Longest Common Subsequence
- Find excel column name from a given column number
- Practice Questions:
- Get Nth node in a linked list
- Delete a node given a pointer to it
- Print middle
- Find Nth node from the end
- Delete linked list
- Reverse linked list
- Detect loop in a linked list
- Check if a singly linked list is a palindrome
- Clone a linked list with next and random pointer
- Memory efficient doubly linked list
- Insert in sorted linked list
- Get intersection point of 2 linked lists
- Print reverse of a linked list
- Remove duplicates from sorted linked list
- Remove duplicates from unsorted linked list
- Reverse doubly linked list
- Merge 2 sorted linked lists
- Merge sort for linked lists
- Reverse a linked list in groups of given size
- Linked list vs Array
- Sorted insert for circular linked list
- Detect and remove loop in a linked list
- XOR linked list
- Add 2 numbers represented by linked lists
- Write C functions that modify head pointer of linked list
- Sorted linked list to balanced BST
- Sorted DLL to BST
- XOR linked list | Set 2
- Flatten a linked list
- Add 2 numbers represented by linked lists | Set 2
- Flatten a multilevel linked list
(Geeks solution has a bug. They are not doing cur->child = NULL after appending it to the tail->next. Looks like there is another bug. In the end we need to check for the child of tail node also i.e child of node 15 in the given case.The loop termination condition should not be cur!=tail. It should be cur!!=NULL. You better see this solution instead ) - Clone a linked list with next and random pointer | Set 2
- Practice Questions:
- Recursive Tree Traversals
- Calculate size of tree
- Check if two trees are identical
- Height of tree
- Delete a tree
- Convert a binary tree to its mirror tree
- Given two traversal sequences, construct the binary tree
- Print all root to leaf paths in a binary tree
- Lowest common ancestor in BST
- Level order traversal
- Count leaf nodes
- Spiral level order traversal
- Diameter of tree
- Inorder traversal without recursion
- Root to leaf path sum equal to given number
- Construct tree from inorder and preorder traversal
- Print nodes at k distance from root
- Applications of tree
- Check if a binary tree is a subtree of another binary tree
- Find inorder successor for all nodes
- Vertical sum in a given binary tree
- Maximum sum root to leaf path
- Check if a binary tree is complete or not
- Iterative preorder traversal
- Iterative postorder traversal
- Reverse level order traversal
- Binary tree to doubly linked list OR Binary tree to double linked list
- Find height of tree iteratively
- Left view of binary tree
- Lowest common ancestor binary tree
- Print all nodes at k distance from given node
- Right view of binary tree
- Check if binary tree is subtree of another binary tree
- Print nodes b/w two given levels
- Serialize and deserialize a binary tree
- Serialize and deserialize an N-ary tree
- Expression tree
- Check if binary tree is symmetric
- Mirror of N-ary tree
- Find node with min value in BST
- Check if a binary tree is BST
- Find kth smallest element in BST
- Sorted linked list to balanced BST
- Kth largest element in BST
- Advantages of BST over hash table
- Kth smallest element in BST using O(1) space
- Practice Questions:
- Practice Questions:
- Practice Questions:
- Practice Questions:
- Practice Questions:
- Practice Questions:
- Practice Questions:
- Practice Questions: