__________________________________________________

**Top Companies Interview Questions..-**

Microsoft | Amazon | more.. |

If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.

__________________________________________________

### Related Posts:

- Implement Stack Using Linked List
- Find the element which appears maximum number of times in the array.
- Maximum difference between two elements where larger element appears after the smaller…
- Graph – Detect Cycle in a Directed Graph
- Stock Single Sell Problem – O(n) Solution
- Sliding Window Algorithm (Track the maximum of each subarray of size k)
- Dynamic Programming – Longest Increasing Subsequence
- Count and print all Subarrays with product less than K in O(n)
- Find the Second Largest Element in an Array
- Dynamic Programming – Highway Billboard Problem