The problem is taken from 15. 3Sum. Naive Approach Naive approach would be to go through all possible triplets in the array. And use set data...
The problem is taken from 118. Pascal's Triangle. Approach Let's make a pascal's triangle of size 5. 1 1 1 1 2 1 1 3 3...
The problem is taken from 88. Merge Sorted Array. Naive approach In this approach, we use a HashMap(Integer, Integer), where the first place would...
The problem is taken from 53. Maximum Subarray. Brute force approach For each element in the array we need to find all possible contiguous subarray...
The problem is taken from 35. Search Insert Position. Approach The solution is very straight forward. We need to do binary search on the given array...
The problem is taken from 26. Remove Duplicates from Sorted Array - LeetCode. Approach The approach is very simple. Let's have two pointers pointing...