This Repository contains solutions to 450 Data Structures and Algorithms!
- Reverse the array | Time Complexity => O(n)
- Find the maximum and minimum element in an array | Time Complexity => O(n)
- Find the "Kth" max and min element of an array | Time Complexity => O(n)
- Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algo | Time Complexity => O(n)
- Move all the negative elements to one side of the array | Time Complexity => O(n) | Auxiliary Space => O(1)
- Find the Union and Intersection of the two sorted arrays. | Time Complexity => O(m + n)
- Write a program to cyclically rotate an array by one. | Time Complexity => O(n) | Auxiliary Space => O(1)
- find Largest sum contiguous Subarray [V. IMP] | Kadane's Algo [V.V.V.V.V IMP] | Time Complexity => O(n)
- Minimise the maximum difference between heights [V.IMP] | Time Complexity => O(nlogn)
- Minimum no. of Jumps to reach end of an array | Time Complexity => O(n) | Auxiliary Space => O(1)
- find duplicate in an array of N+1 Integers | Time Complexity => O(n) | Auxiliary Space => O(1)
- Merge 2 sorted arrays without using Extra space. | Time Complexity => O((n+m)*log(n+m)) | Auxiliary Space => O(1)
- Merge Intervals | Time Complexity => O(nlogn)
- Next Interval | Time Complexity => O(n)
- Count Inversions | Time Complexity => O(nlogn)
- Best Time to Buy and Sell | Time Complexity => O(n)
- Two Sum Problem | Find all pairs on integer array whose sum is equal to given number | Time Complexity => O(n)
- Find common elements In 3 sorted arrays | Time Complexity => O(n1 + n2 + n3)
- Rearrange the array in alternating positive and negative items with O(1) extra space | Time Complexity => O(nlogn) | Aux Space => O(1)
- Find if there is any subarray with sum equal to 0 | Time Complexity => O(n)
- Reverse a string
- Check whether a string is Palindrome on not
- Find duplicate characters in a String
- Write a code to check whether one string is rotation of another
- WAP to check whether a string is valid shuffle of two strings or not
- Count and Say problem
- WAP to find the longest Palindrome in a string (Longest Palindromic substring)
- Find longest recurring subsequence in a string
- Print all subsequences of a String
- Search an element in a Matrix (Search in 2D Matrix)
- Search in a rotated sorted array