13. arrays medium
Priority-wise Two sum problem✅ sort arr of 0s, 1s, 2s✅ DNF majority elmt✅ Moore voting algo max subarray sum✅ Kadane algo buy & sell stocks✅ Next permutation🔥 Longest consecutive seq🔥 Rotate matrix by 90 CW✅ Count subarrays with sum k🔥 Rearrange the array in alternating + & - items ✅ Set matrix rows& cols to 0s for zero elmt✅ Spiral matrix✅ Leaders in an array✅ ---------------------------------------------------------------------------------------------------------- 2 sum problem- return index of 2 elmts in array which adds up to equal the target sum Brute- O(N^2) Better-(NlogN) ---------------------------------------------------------------------------------------------------------------------------- Sort an array of 0s, 1s, 2s- Brute - (NlogN) sort Better -(2N, with no extra space) cnt no of 0,1,2 and overwrite using loops Optimal -(N) DNF Algo -( dutch national flag ) 3 ...