General Approach

  1. Check if the given problem can be converted to graph problem
  2. Check if it can be solved by using Greedy

Approach for arrays

  1. Sorting
  2. Hash map
  3. Finding an element : XOR
  4. Dynamic Programming
  5. Minimum number of comparisons : Tournament Method
  6. Traverse array from right hand side
  7. Change array elements if needed (Find duplicate element(s))
  8. Bucketizing the array, Here is an example
  9. 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

  1. Subset Bitmasking

ToDo

  1. Implementation of Heap
  2. Implement Binary search
    1. Find Element
    2. First Occurrance
    3. Last Occurrence
    4. Floor of given element
    5. Ceil of given element
  3. Interpolation search

Surprisingly interesting questions

  1. Find the median of a very big array of integer. Only iterator of array is given. [Solution]
  2. 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]

results matching ""

    No results matching ""