From d40300a843afd602aa30ea8762700b72b4381dfe Mon Sep 17 00:00:00 2001 From: Tannistha Biswas Date: Fri, 14 Oct 2022 14:10:22 +0530 Subject: [PATCH] Updated Readme.MD adding Space and Time complexity, and difficulty level for all 36 array problems --- README.md | 68 +++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index b195b02..4dbf959 100644 --- a/README.md +++ b/README.md @@ -38,42 +38,42 @@ This is an attempt to solve 450 questions carefully curated by our very own **[L | # | Title | Solution | Time | Space | Difficulty | Note | | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ | ---- | ----- | ---------- | ------------------ | -| 1 | [Reverse an Array](https://www.geeksforgeeks.org/write-a-program-to-reverse-an-array-or-string/) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 2 | [Find the maximum and minimum element in an array](https://www.geeksforgeeks.org/maximum-and-minimum-in-an-array/) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 3 | [Find the "Kth" max and min element of an array](https://practice.geeksforgeeks.org/problems/kth-smallest-element/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 4 | [Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algo](https://practice.geeksforgeeks.org/problems/sort-an-array-of-0s-1s-and-2s/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 5 | [Move all the negative elements to one side of the array ](https://www.geeksforgeeks.org/move-negative-numbers-beginning-positive-end-constant-extra-space//) | :heavy_check_mark: | _-_ | - | - | -| 6 | [Find the Union and Intersection of the two sorted arrays.](https://practice.geeksforgeeks.org/problems/union-of-two-arrays/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 7 | [Write a program to cyclically rotate an array by one.](https://practice.geeksforgeeks.org/problems/cyclically-rotate-an-array-by-one/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 8 | [find Largest sum contiguous Subarray V. IMP](https://practice.geeksforgeeks.org/problems/kadanes-algorithm/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 9 | [Minimise the maximum difference between heights V.IMP](https://practice.geeksforgeeks.org/problems/minimize-the-heights3351/1) | :heavy_check_mark: | _-_ | _-_ | - | Revisit | -| 10 | [Minimum no. of Jumps to reach end of an array](https://practice.geeksforgeeks.org/problems/minimum-number-of-jumps/0) | :heavy_check_mark: | _-_ | _-_ | - | Revisit | -| 11 | [find duplicate in an array of N+1 Integers](https://leetcode.com/problems/find-the-duplicate-number/) | :heavy_check_mark: | _-_ | _-_ | - | - | +| 1 | [Reverse an Array](https://www.geeksforgeeks.org/write-a-program-to-reverse-an-array-or-string/) | :heavy_check_mark: | O(n) | O(1) | Basic | - | +| 2 | [Find the maximum and minimum element in an array](https://www.geeksforgeeks.org/maximum-and-minimum-in-an-array/) | :heavy_check_mark: | O(n) | O(1) | Easy | - | +| 3 | [Find the "Kth" max and min element of an array](https://practice.geeksforgeeks.org/problems/kth-smallest-element/0) | :heavy_check_mark: | O(n) | O(log(n)) | Medium | - | +| 4 | [Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algo](https://practice.geeksforgeeks.org/problems/sort-an-array-of-0s-1s-and-2s/0) | :heavy_check_mark: | O(N) | O(1) | Easy | - | +| 5 | [Move all the negative elements to one side of the array ](https://www.geeksforgeeks.org/move-negative-numbers-beginning-positive-end-constant-extra-space//) | :heavy_check_mark: | O(N) | O(1) | Easy | +| 6 | [Find the Union and Intersection of the two sorted arrays.](https://practice.geeksforgeeks.org/problems/union-of-two-arrays/0) | :heavy_check_mark: | O((n+m)log(n+m)) | O(n+m) | Basic | - | +| 7 | [Write a program to cyclically rotate an array by one.](https://practice.geeksforgeeks.org/problems/cyclically-rotate-an-array-by-one/0) | :heavy_check_mark: | O((n+m)log(n+m)) | O(n+m) | Basic | - | +| 8 | [find Largest sum contiguous Subarray V. IMP](https://practice.geeksforgeeks.org/problems/kadanes-algorithm/0) | :heavy_check_mark: | O(N) | O(1) | Medium | - | +| 9 | [Minimise the maximum difference between heights V.IMP](https://practice.geeksforgeeks.org/problems/minimize-the-heights3351/1) | :heavy_check_mark: | O(N*logN) | O(N) | Medium | Revisit | +| 10 | [Minimum no. of Jumps to reach end of an array](https://practice.geeksforgeeks.org/problems/minimum-number-of-jumps/0) | :heavy_check_mark: | O(N) | O(1) | Medium | Revisit | +| 11 | [find duplicate in an array of N+1 Integers](https://leetcode.com/problems/find-the-duplicate-number/) | :heavy_check_mark: | _-_ | _-_ | Medium | - | | 12 | [Merge 2 sorted arrays without using Extra space.](https://practice.geeksforgeeks.org/problems/merge-two-sorted-arrays5135/1) | :heavy_check_mark: | _-_ | _-_ | - | Revisit | -| 13 | [Kadane's Algo [V.V.V.V.V IMP]](https://practice.geeksforgeeks.org/problems/kadanes-algorithm/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 14 | [Merge Intervals](https://leetcode.com/problems/merge-intervals/) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 15 | [Next Permutation ](https://leetcode.com/problems/next-permutation/) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 16 | [Count Inversion](https://practice.geeksforgeeks.org/problems/inversion-of-array/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 17 | [Best time to buy and Sell stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | :heavy_check_mark: | _-_ | _-_ | - | Pending variations | -| 18 | [find all pairs on integer array whose sum is equal to given number](https://practice.geeksforgeeks.org/problems/count-pairs-with-given-sum5022/1) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 19 | [find common elements In 3 sorted arrays](https://practice.geeksforgeeks.org/problems/common-elements1132/1) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 20 | [Rearrange the array in alternating positive and negative items with O(1) extra space](https://www.geeksforgeeks.org/rearrange-array-alternating-positive-negative-items-o1-extra-space/) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 21 | [Find if there is any subarray with sum equal to 0](https://practice.geeksforgeeks.org/problems/subarray-with-0-sum/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 22 | [Find factorial of a large number](https://practice.geeksforgeeks.org/problems/factorials-of-large-numbers/0) | :heavy_check_mark: | _-_ | _-_ | - | | -| 23 | [find maximum product subarray ](https://practice.geeksforgeeks.org/problems/maximum-product-subarray3604/1) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 24 | [Find longest coinsecutive subsequence](https://practice.geeksforgeeks.org/problems/longest-consecutive-subsequence/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 25 | [Given an array of size n and a number k, fin all elements that appear more than " n/k " times.](https://www.geeksforgeeks.org/given-an-array-of-of-size-n-finds-all-the-elements-that-appear-more-than-nk-times/) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 26 | [Maximum profit by buying and selling a share atmost twice](https://www.geeksforgeeks.org/maximum-profit-by-buying-and-selling-a-share-at-most-twice/) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 27 | [Find whether an array is a subset of another array](https://practice.geeksforgeeks.org/problems/array-subset-of-another-array/0) | :heavy_check_mark: | _-_ | _-_ | - | -| 28 | [Find the triplet that sum to a given value](https://practice.geeksforgeeks.org/problems/triplet-sum-in-array/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 29 | [Trapping Rain water problem](https://practice.geeksforgeeks.org/problems/trapping-rain-water/0) | :heavy_check_mark: | _-_ | _-_ | - | Revisit | -| 30 | [Chocolate Distribution problem](https://practice.geeksforgeeks.org/problems/chocolate-distribution-problem/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 31 | [Smallest Subarray with sum greater than a given value](https://practice.geeksforgeeks.org/problems/smallest-subarray-with-sum-greater-than-x/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 32 | [Three way partitioning of an array around a given value](https://practice.geeksforgeeks.org/problems/three-way-partitioning/1) | :heavy_check_mark: | _-_ | _-_ | - | | -| 33 | [Minimum swaps required bring elements less equal K together ](https://practice.geeksforgeeks.org/problems/minimum-swaps-required-to-bring-all-elements-less-than-or-equal-to-k-together/0) | :heavy_check_mark: | _-_ | _-_ | - | - | +| 13 | [Kadane's Algo [V.V.V.V.V IMP]](https://practice.geeksforgeeks.org/problems/kadanes-algorithm/0) | :heavy_check_mark: | O(N) | O(1) | Medium | - | +| 14 | [Merge Intervals](https://leetcode.com/problems/merge-intervals/) | :heavy_check_mark: | _-_ | _-_ | Medium | - | +| 15 | [Next Permutation ](https://leetcode.com/problems/next-permutation/) | :heavy_check_mark: | O(NLogN) | O(N) | Medium | - | +| 16 | [Count Inversion](https://practice.geeksforgeeks.org/problems/inversion-of-array/0) | :heavy_check_mark: | O(NLogN) | O(N) | Medium | - | +| 17 | [Best time to buy and Sell stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | :heavy_check_mark: | O(N) | O(N) | Easy | Pending variations | +| 18 | [find all pairs on integer array whose sum is equal to given number](https://practice.geeksforgeeks.org/problems/count-pairs-with-given-sum5022/1) | :heavy_check_mark: | O(n1 + n2 + n3) | O(n1 + n2 + n3) | Easy | - | +| 19 | [find common elements In 3 sorted arrays](https://practice.geeksforgeeks.org/problems/common-elements1132/1) | :heavy_check_mark: | O (N) | O (1) | Medium | - | +| 20 | [Rearrange the array in alternating positive and negative items with O(1) extra space](https://www.geeksforgeeks.org/rearrange-array-alternating-positive-negative-items-o1-extra-space/) | :heavy_check_mark: | O (N) | O (1) | Medium | - | +| 21 | [Find if there is any subarray with sum equal to 0](https://practice.geeksforgeeks.org/problems/subarray-with-0-sum/0) | :heavy_check_mark: | O(N) | O(N) | Easy | - | +| 22 | [Find factorial of a large number](https://practice.geeksforgeeks.org/problems/factorials-of-large-numbers/0) | :heavy_check_mark: | O(N^2) | O(1) | Medium | | +| 23 | [find maximum product subarray ](https://practice.geeksforgeeks.org/problems/maximum-product-subarray3604/1) | :heavy_check_mark: | O(N) | O(1) | Medium | - | +| 24 | [Find longest coinsecutive subsequence](https://practice.geeksforgeeks.org/problems/longest-consecutive-subsequence/0) | :heavy_check_mark: | O(N) |O(N) | Medium | - | +| 25 | [Given an array of size n and a number k, fin all elements that appear more than " n/k " times.](https://www.geeksforgeeks.org/given-an-array-of-of-size-n-finds-all-the-elements-that-appear-more-than-nk-times/) | :heavy_check_mark: | O(N) | O(N) | Medium | - | +| 26 | [Maximum profit by buying and selling a share atmost twice](https://www.geeksforgeeks.org/maximum-profit-by-buying-and-selling-a-share-at-most-twice/) | :heavy_check_mark: | O(N) | O(N) | Hard | - | +| 27 | [Find whether an array is a subset of another array](https://practice.geeksforgeeks.org/problems/array-subset-of-another-array/0) | :heavy_check_mark: | O(N) | O(N) | Easy | +| 28 | [Find the triplet that sum to a given value](https://practice.geeksforgeeks.org/problems/triplet-sum-in-array/0) | :heavy_check_mark: | O(N^2) | O(1) | Medium | - | +| 29 | [Trapping Rain water problem](https://practice.geeksforgeeks.org/problems/trapping-rain-water/0) | :heavy_check_mark: | O(N) | O(N) | Medium | Revisit | +| 30 | [Chocolate Distribution problem](https://practice.geeksforgeeks.org/problems/chocolate-distribution-problem/0) | :heavy_check_mark: | O(N*Log(N)) | O(1) | Easy | - | +| 31 | [Smallest Subarray with sum greater than a given value](https://practice.geeksforgeeks.org/problems/smallest-subarray-with-sum-greater-than-x/0) | :heavy_check_mark: | O(N) | O(1) | Easy | - | +| 32 | [Three way partitioning of an array around a given value](https://practice.geeksforgeeks.org/problems/three-way-partitioning/1) | :heavy_check_mark: | O(N) | O(1) | Easy | | +| 33 | [Minimum swaps required bring elements less equal K together ](https://practice.geeksforgeeks.org/problems/minimum-swaps-required-to-bring-all-elements-less-than-or-equal-to-k-together/0) | :heavy_check_mark: | O(N) | O(1) | Medium | - | | 34 | [Minimum no. of operations required to make an array palindrome](https://practice.geeksforgeeks.org/problems/palindromic-array/0) | :heavy_check_mark: | _-_ | _-_ | - | - | -| 35 | [Median of 2 sorted arrays of equal size](https://www.geeksforgeeks.org/median-of-two-sorted-arrays/) | :heavy_check_mark: | _-_ | _-_ | - | Revisit | -| 36 | [Median of 2 sorted arrays of different size](https://www.geeksforgeeks.org/median-of-two-sorted-arrays-of-different-sizes/) | :heavy_check_mark: | _-_ | _-_ | - | - | +| 35 | [Median of 2 sorted arrays of equal size](https://www.geeksforgeeks.org/median-of-two-sorted-arrays/) | :heavy_check_mark: | O(N) | O(1) | Hard | Revisit | +| 36 | [Median of 2 sorted arrays of different size](https://www.geeksforgeeks.org/median-of-two-sorted-arrays-of-different-sizes/) | :heavy_check_mark: | O(min(log M, log N)) | O(1) | Expert | - |