Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,063 views

I have solved about 50 problems on leetcode, and I've learned that to solve almost any problem, a specific approach has to be followed. I find it hard to keep track of the patterns, tricks, explanations. By notes I do not mean notes explaining the the topic itself (say Arrays), but notes about the approach and patterns to follow for solving problems on that topic. These notes could be more like a cheatsheet.

Anybody who has mastered Leetcode or DSA in general, how did you maintain notes while solving? Also, sometimes creating notes becomes very tedious.

I know that a lot of hard work goes into this, but can anyone share their notes if possible?

 

 

An example from my notes more clarity: (May have mistakes, Not well written)

 

1) Sliding Window Technique *** For Min sum, Max sum, Longest, Shortest, Contiguous Subarray/substring type Problems Two types of Sliding Window: 1) Fixed Size Window (Size of Subarray fixed) 

2) Dynamic size Window (Size of Subarray not fixed) 
- Time Complex O(n), Space O(1) - Bruteforce approach is normally O(n*k) or O(n^2) * Easy: Statically Sized Sliding Window: Very Simple solution, add the first k elements, where k = subarray size. Then run through the array once, where on each iteration, Subtract the last element from the sum, and add the new element. Compare & update max_sum accordingly on every iteration. * Medium: Dynamically Sized Sliding Window: (For Positive Numbers only) For problems like find subarray with sum > k or sum = k, Start from the first index. Now add subsequent elements till the sum <= k. If sum becomes greater than k, then shrink the tail of the subarray. Repeat this process till end of array. Also, compare and update your max/min variable accordingly on every iteration. - For intuitive thinking, imagine the Array?/LL as a long rectangle, and we slap a window to this rectangle(which is our subarray) that slides upon it. - Two pointer technique is quite similar to sliding window but in Two Pointers we usually compare the value at the two pointers instead of all the elements between the pointers. - SLIDING WINDOW WILL NOT WORK FOR DYNAMIC WINDOWS WITH -VE VALUES. USE KADANE'S ALGO OR SOME OTHER APPROACH.
in Advice/Suggestion/Opinion by | 1,063 views

Please log in or register to answer this question.