└── README.md
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Data-Structures-RoadMap
3 | Data structures roadmap to solve 150+ leetcode problems in 5 weeks with a good understanding of basics and techniques
4 |
5 | Some **considerations** while starting with problem-solving till 100+ Leetcode problems are solved:
6 |
7 | - Start with the most-easiest problems.
8 | - DO NOT try to solve each problem yourself, instead try to learn and understand how different problems are being solved
9 | - Do not try to solve a problem for more than 1 hour initially to get fast and to achieve more in less time, for any problem taking more than 1 hour, put it in a backlog and solve it later
10 | - Average time to solve a problem should be 30-45 minutes
11 | - Do not try to solve a lot of problems from one topic, instead try to solve 5-10 problems per topic
12 | - Do not try to jump into problem-solving directly without the necessary pre-requisites, For example
13 | > If you are trying to solve a problem that requires HashSet/HashMap then make sure you have studied HashMap before solving the problem
14 | > If you are trying to solve a problem that uses recursion, first make sure you learn recursion properly
15 | > If you are trying to solve a problem that uses graphs/trees, first make sure you learn graphs/tree properly
16 | > If you are trying to solve a problem that uses dynamic programming, first make sure you learn dynamic programming properly.
17 |
18 | ## Week 1- Data Structures Overview:
19 |
20 | - Basic Understanding of Data structures in your language (C++ STL, C# Collections, Python Standard Library)
21 | - If you like C++ and more details > My code school Data Structures
22 |
23 | https://www.youtube.com/playlist?list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P (C++)
24 |
25 | - If you like Python > code basics - Data Structures
26 |
27 | https://www.youtube.com/playlist?list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12
28 |
29 | - Introduction to Hash Tables and Dictionaries by CS Dojo:
30 |
31 | https://www.youtube.com/watch?v=sfWyugl4JWA
32 |
33 | ## Week 2 - 25 EASY problems ( 3-4 hours a day | 4 problems a day):
34 |
35 | - Easy String Algorithms
36 |
37 | 1. String as character arrays:
38 |
39 | video: https://www.youtube.com/watch?v=TkTgo_7ab0M&pp=ygUQcHJpbnQgY2hhcmFjdGVycw%3D%3D
40 |
41 | 2. Count characters in string
42 |
43 | video: https://www.youtube.com/watch?v=kWr0TIjO6nU
44 |
45 | - Arrays & Hashing:_
46 |
47 | 1. Contains Duplicate
48 |
49 | video: https://www.youtube.com/watch?v=3OamzN90kPg
50 | problem: https://leetcode.com/problems/contains-duplicate/
51 |
52 | 2. Valid Anagram:
53 |
54 | video: https://www.youtube.com/watch?v=9UtInBqnCgA
55 | problem: https://leetcode.com/problems/valid-anagram
56 |
57 | 3. Two Sum:
58 |
59 | video: https://www.youtube.com/watch?v=KLlXCFG5TnA
60 | problem: (https://leetcode.com/problems/two-sum/)
61 |
62 | 4. Length of Last word:
63 |
64 | video: https://www.youtube.com/watch?v=KT9rltZTybQ&list=PLot-Xpze53lfQmTEztbgdp8ALEoydvnRQ&index=27
65 | problem: https://leetcode.com/problems/length-of-last-word/
66 |
67 | 5. Search Insert Position
68 |
69 | video: https://www.youtube.com/watch?v=K-RYzDZkzCI&list=PLot-Xpze53lfQmTEztbgdp8ALEoydvnRQ&index=23
70 | problem: https://leetcode.com/problems/search-insert-position/
71 |
72 | - Two Pointers:_
73 |
74 | 1. Valid Palindrome
75 |
76 | video: [https://leetcode.com/problems/valid-palindrome/](https://youtu.be/jJXJ16kPFWg?si=pdfi7FrWzoxV0h-M)
77 | problem: https://leetcode.com/problems/valid-palindrome/
78 |
79 | 2. Best time to buy and Sell Stock:
80 |
81 | video: https://www.youtube.com/watch?v=1pkOgXD63yU&list=PLot-Xpze53lfQmTEztbgdp8ALEoydvnRQ&index=7&pp=iAQB
82 | problem: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
83 |
84 | 3. Maximum Subarray
85 | LeetCode #53
86 | https://leetcode.com/problems/maximum-subarray/
87 |
88 | 4. Container With Most Water
89 | LeetCode #11
90 | https://leetcode.com/problems/container-with-most-water/
91 |
92 | 5 . Best Time to Buy and Sell Stock II
93 | LeetCode #122
94 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
95 |
96 |
97 | - Stack & Queue Problems:_
98 |
99 | 1. Valid Parenthesis
100 |
101 | video: https://www.youtube.com/watch?v=WTzjTskDFMg
102 | problem: https://leetcode.com/problems/valid-parentheses/
103 |
104 | 2. Implement Stack using Queue:
105 |
106 | video: https://www.youtube.com/watch?v=rW4vm0-DLYc&list=PLot-Xpze53lfxD6l5pAGvCD4nPvWKU8Qo&index=10
107 | problem: https://leetcode.com/problems/implement-stack-using-queues/
108 |
109 | 3. Implement Queue using Stack:
110 |
111 | video: https://www.youtube.com/watch?v=3Et9MrMc02A&pp=ygUabmVldGNvZGUgcXVldWUgdXNpbmcgc3RhY2s%3D
112 | problem: https://leetcode.com/problems/implement-queue-using-stacks/
113 |
114 | 4. Sqrt(x)
115 |
116 | problem: https://leetcode.com/problems/sqrtx/
117 | video:
118 |
119 | 5. 704 Binary Search
120 |
121 | problem: https://leetcode.com/problems/binary-search/
122 | video:
123 |
124 | 6. Count Negative Numbers in a Sorted Matrix
125 |
126 | problem: https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/
127 | video:
128 |
129 | 7. Peak Index in a Mountain Array
130 |
131 |
132 | - problem: https://leetcode.com/problems/peak-index-in-a-mountain-array/
133 | - video:
134 |
135 | 8. Find Peak element:
136 |
137 | - video: https://www.youtube.com/watch?v=CFgUQUL7j_c
138 | - problem: https://leetcode.com/problems/find-peak-element/
139 |
140 | 9. Maximum Sub Array:
141 |
142 | - video: https://www.youtube.com/watch?v=5WZl3MMT0Eg&list=PLot-Xpze53lfQmTEztbgdp8ALEoydvnRQ&index=4
143 | - problem: https://leetcode.com/problems/maximum-subarray/
144 |
145 | ### Recursion Course ( don't watch the trees or graphs section):
146 |
147 | https://www.youtube.com/watch?v=IJDJ0kBx2LM
148 |
149 |
150 | - Linked List Course:_
151 |
152 | course with problems (find all the similar problems on leetcode):
153 | video: https://www.youtube.com/watch?v=Hj_rA0dhr2I&pp=ygUXbGlua2VkbGlzdCBmcmVlY29kZWNhbXA%3D
154 |
155 |
156 | - Linked list problems:_
157 |
158 | 1. Reverse Linked List
159 |
160 | https://leetcode.com/problems/reverse-linked-list/
161 | https://www.youtube.com/watch?v=G0_I-ZF0S38
162 |
163 | 2. Merge 2 sorted Lits
164 |
165 | https://leetcode.com/problems/merge-two-sorted-lists/
166 | https://www.youtube.com/watch?v=XIdigk956u0
167 |
168 | 3. Linked List Cycle
169 |
170 | https://leetcode.com/problems/linked-list-cycle/
171 | https://www.youtube.com/watch?v=gBTe7lFR3vc
172 |
173 | 4. Reverse Linked List - Iterative AND Recursive
174 |
175 | video: https://www.youtube.com/watch?v=G0_I-ZF0S38&list=PLot-Xpze53lfQmTEztbgdp8ALEoydvnRQ&index=10&pp=iAQB
176 | code: https://leetcode.com/problems/reverse-linked-list/
177 |
178 | 5. Palindrome Linked List
179 |
180 | video: https://www.youtube.com/watch?v=yOzXms1J6Nk&list=PLot-Xpze53lfQmTEztbgdp8ALEoydvnRQ&index=13
181 | problem:
182 |
183 | 6. Remove Linked List element:
184 |
185 | video: https://www.youtube.com/watch?v=JI71sxtHTng&list=PLot-Xpze53lfQmTEztbgdp8ALEoydvnRQ&index=21&pp=iAQB
186 | problem:
187 |
188 | ## Week 3
189 |
190 | # Hash table
191 |
192 | 1- Happy Number
193 | https://leetcode.com/problems/happy-number/
194 |
195 |
196 | 2- Isomorphic Strings
197 | https://leetcode.com/problems/isomorphic-strings/
198 |
199 |
200 | 3- Missing Number
201 | https://leetcode.com/problems/missing-number/
202 |
203 |
204 | 4- Word Pattern
205 | https://leetcode.com/problems/word-pattern/
206 |
207 | 5- Next Greater Element I
208 | https://leetcode.com/problems/next-greater-element-i/
209 |
210 | # Trees
211 |
212 | ### Recursion Course (watch the trees section):
213 |
214 | https://www.youtube.com/watch?v=IJDJ0kBx2LM
215 |
216 |
217 | Trees Full Course:
218 | https://www.youtube.com/watch?v=fAAZixBzIAI
219 |
220 |
221 | # Graphs
222 |
223 | ### Recursion Course ( watch the graphs section):
224 |
225 | https://www.youtube.com/watch?v=IJDJ0kBx2LM
226 |
227 | Graphs Full Course:
228 |
229 | https://www.youtube.com/watch?v=tWVWeAqZ0WU
230 |
231 | 1-Find the Town Judge
232 |
233 | video: https://www.youtube.com/watch?v=ZUP_tIs4VaE
234 |
235 | problem https://leetcode.com/problems/find-the-town-judge/
236 |
237 | 2- Find Center of Star Graph
238 |
239 | video: https://www.youtube.com/watch?v=KEKcW6eLyEY
240 |
241 | problem: https://leetcode.com/problems/find-center-of-star-graph/
242 |
243 |
244 | 3-Find if Path Exists in Graph
245 |
246 | video: https://www.youtube.com/watch?v=QC4bDHEnmLM&pp=ygUfMTc5MS4gRmluZCBDZW50ZXIgb2YgU3RhciBHcmFwaA%3D%3D
247 |
248 | problem: https://leetcode.com/problems/find-if-path-exists-in-graph/
249 |
250 | ## DFS
251 |
252 | 1- Binary Tree Inorder Traversal
253 | - video: https://youtu.be/g_S5WuasWUE
254 | - problem: https://leetcode.com/problems/binary-tree-inorder-traversal
255 |
256 | 2- Binary Tree Preorder Traversal
257 | - video: https://youtu.be/afTpieEZXck
258 | - problem: https://leetcode.com/problems/binary-tree-preorder-traversal
259 |
260 | 3- Binary Tree Postorder Traversal
261 | - video: https://youtu.be/QhszUQhGGlA
262 | - problem: https://leetcode.com/problems/binary-tree-postorder-traversal
263 |
264 | 4- Validate Binary Search Tree
265 | - video: https://youtu.be/s6ATEkipzow
266 | - problem: https://leetcode.com/problems/validate-binary-search-tree
267 |
268 | 5- Path Sum
269 | - video: https://youtu.be/LSKQyOz_P8I
270 | - problem: https://leetcode.com/problems/path-sum
271 |
272 | 6- Pacific Atlantic Water Flow
273 | - video: https://youtu.be/s-VkcjHqkGI
274 | - problem: https://leetcode.com/problems/pacific-atlantic-water-flow
275 |
276 |
277 | ## BFS
278 |
279 | 1- Binary Tree Level Order Traversal
280 | - video: https://youtu.be/6ZnyEApgFYg
281 | - problem: https://leetcode.com/problems/binary-tree-level-order-traversal
282 |
283 | 2- Maximum Depth of Binary Tree
284 | - video: https://youtu.be/hTM3phVI6YQ
285 | - problem: https://leetcode.com/tag/breadth-first-search/
286 |
287 | 3- Same Tree
288 | - video: https://youtu.be/vRbbcKXCxOw
289 | - problem: https://leetcode.com/problems/same-tree/
290 |
291 |
292 | ## Graph Algorithm for Technical Interview
293 | - video: https://youtu.be/tWVWeAqZ0WU
294 |
295 |
296 | ## Week 4:
297 |
298 | ## Dynamic Programming (DP):
299 |
300 | Dynamic Programming (DP) Full Course:
301 | https://www.youtube.com/watch?v=oBt53YbR9Kk&t=29s
302 |
303 | - Easy Problems:
304 | 1. Counting Bits: https://leetcode.com/problems/counting-bits/
305 | Video: https://youtu.be/AgMr5uojxbM
306 |
307 | 2. Divisor Game: https://leetcode.com/problems/divisor-game/
308 | Video: https://www.youtube.com/watch?v=UbE4-ONpJcc&ab_channel=Fraz
309 |
310 | 3. Climbing Stairs: https://leetcode.com/problems/climbing-stairs/
311 | Video: https://youtu.be/UUaMrNOvSqg
312 |
313 | 4. Best Time to Buy and Sell Stock: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
314 | Video: https://youtu.be/excAOvwF_Wk
315 |
316 | 5. Min Cost Climbing Stairs: https://leetcode.com/problems/min-cost-climbing-stairs/
317 | Video: https://youtu.be/8TDeGdY6qaM
318 |
319 | 6. Fibonacci Number: https://leetcode.com/problems/fibonacci-number/
320 | Video: https://youtu.be/WvffCsh3Nt4
321 |
322 | 7. N-th Tribonacci Number: https://leetcode.com/problems/n-th-tribonacci-number/
323 | Video: https://youtu.be/WvffCsh3Nt4
324 |
325 | - Medium Problems:
326 | 1. Word Break: https://leetcode.com/problems/word-break/
327 | Video: https://youtu.be/_iIK7Gu7MNo
328 |
329 | 2. House Robber: https://leetcode.com/problems/house-robber/
330 | Video: https://youtu.be/ZwDDLAeeBM0
331 |
332 | 3. Maximum Subarray: https://leetcode.com/problems/maximum-subarray/
333 | Video: https://youtu.be/6HntYGZyjZI
334 |
335 |
336 | ## Divide and Conquer
337 |
338 | - Divide & Conquer Algorithm: https://youtu.be/YOh6hBtX5l0
339 |
340 | 1- Majority Element
341 | - video: https://youtu.be/28D-VLSXBt0
342 | - problem: https://leetcode.com/problems/majority-element
343 |
344 | 2- Maximum Subarray
345 | - video: https://youtu.be/ohHWQf1HDfU
346 | - problem: https://leetcode.com/problems/maximum-subarray
347 |
348 | 3- Kth Large Element in an Array
349 | - video: https://youtu.be/XEmy13g1Qxc
350 | - problem: https://leetcode.com/problems/kth-largest-element-in-an-array
351 |
352 | 4- Sort an Array
353 | - video: https://youtu.be/MsYZSinhuFo
354 | - problem: https://leetcode.com/problems/sort-an-array
355 |
356 | ### Room Task
357 | - Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements
358 | - Merge k Sorted Lists: https://leetcode.com/problems/merge-k-sorted-lists
359 |
360 |
361 | ## Week 5 - Backtracking
362 |
363 | #### simple trick backtracking is DP which undoes its operation if it doesn't find the answer:
364 |
365 |
366 | 1- Letter Combinations of a Phone Number
367 |
problem https://leetcode.com/problems/letter-combinations-of-a-phone-number/
368 |
video: https://www.youtube.com/watch?v=irkG33phXuw
369 |
370 | 2- The k-th Lexicographical String of All Happy Strings of Length n
371 |
problem https://leetcode.com/problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/
372 |
video: https://www.youtube.com/watch?v=t3Hb0NYOA1c
373 |
374 | ## ++++++++++++++++++++++++++++++++++++++++++
375 |
376 | ## Some more nice problems (to be updated):
377 |
378 | 1. [Best Time to Buy and Sell Stock](https://leetcode.com/submissions/detail/916673578/)
379 |
380 | 2. [First Bad Version](https://leetcode.com/submissions/detail/915669147/)
381 |
382 | 3. [Isomorphic Strings](https://leetcode.com/submissions/detail/916216154/)
383 |
384 | 4. [Two Sum](https://leetcode.com/submissions/detail/916217157/)
385 |
386 | 5. [Squares of a Sorted Array](https://leetcode.com/submissions/detail/916672517/)
387 |
388 | 6. [Merge Two Sorted Lists](https://leetcode.com/submissions/detail/916672180/)
389 |
390 | 7. [Is Subsequence](https://leetcode.com/submissions/detail/916216639/)
391 |
392 | 8. [Two Sum II - Input Array Is Sorted](https://leetcode.com/submissions/detail/916673386/)
393 |
394 | 9. [Rotate Array](https://leetcode.com/submissions/detail/916672820/)
395 |
396 | 10. [Reverse Linked List](https://leetcode.com/submissions/detail/916672260/)
397 |
398 | 11. [Search Insert Position](https://leetcode.com/submissions/detail/915672113/)
399 |
400 |
401 | ## Some good resources (to be updated):
402 |
403 | - Bit Manipulation Reading:
404 | https://www.youtube.com/watch?v=7jkIUgLC29I
405 |
--------------------------------------------------------------------------------