General Approach
- Check if the given problem can be converted to graph problem
- Check if it can be solved by using Greedy
Approach for arrays
- Sorting
- Hash map
- Finding an element : XOR
- Dynamic Programming
- Minimum number of comparisons : Tournament Method
- Traverse array from right hand side
- Change array elements if needed (Find duplicate element(s))
- Bucketizing the array, Here is an example
- If we want to find a solution, check if we can binary search over a range, i.e, search for an answer in the range, Here is an example
Approach for DP
- Subset Bitmasking
ToDo
- Implementation of Heap
- Implement Binary search
- Find Element
- First Occurrance
- Last Occurrence
- Floor of given element
- Ceil of given element
- Interpolation search
Surprisingly interesting questions
- Find the median of a very big array of integer. Only iterator of array is given. [Solution]
- Give an array A of n integers where 1 <= a[i] <= K. Find out the length of the shortest sequence that can be constructed out of numbers 1, 2, .. k that is NOT a subsequence of A. [Solution]