LeetCode Was Hard Until I Learned THESE 8 Patterns (With Templates!)

  Рет қаралды 176,708

AlgoMonster

AlgoMonster

Күн бұрын

Пікірлер: 87
@yashshukla1637
@yashshukla1637 3 ай бұрын
- **Introduction:** - 8 important patterns for coding interviews split into two categories: - **Linear structures:** arrays, linked lists, strings. - **Nonlinear structures:** trees, graphs. - Focus on pre-built code templates for these patterns. - **Linear Data Structure Patterns:** 1. **Two Pointers:** - Reduces time complexity to linear time \(O(n)\). - Two methods: - Same direction: used for scanning data in a single pass (e.g., fast and slow pointers to detect cycles or find middle elements). - Opposite directions: used for finding pairs (e.g., sum of two numbers in a sorted array). 2. **Sliding Window:** - Refines two pointers to manage a window of elements dynamically. - Expands or contracts the window to meet specific conditions (e.g., longest substring without repeating characters). - Often combined with hashmaps. 3. **Binary Search:** - Efficiently finds target in logarithmic time \(O(\log n)\). - Extends to lists with monotonic conditions, not just sorted numbers. - Example: finding the minimum in a rotated sorted array. - **Nonlinear Data Structure Patterns:** 4. **Breadth-First Search (BFS):** - Explores nodes level by level. - Uses a queue to keep track of visited nodes (ideal for level order traversal). 5. **Depth-First Search (DFS):** - Dives deep into one path before exploring others. - Often uses recursion and is memory efficient for exploring all paths. - Example: counting islands in a grid. 6. **Backtracking:** - Extension of DFS, explores all possible solutions. - Builds the solution dynamically by making decisions and backtracking on invalid paths. - Example: letter combinations of a phone number. - **Heaps (Priority Queue):** 7. **Heaps:** - Used for questions related to top K, K smallest/largest. - **Min Heap:** smallest value at the root. - **Max Heap:** largest value at the root. - Max Heap is used to find K smallest values, and vice versa for K largest. - **Dynamic Programming (DP):** 8. **Dynamic Programming:** - Optimizes solutions by breaking problems into overlapping subproblems. - Two approaches: - **Top-down:** recursive with memoization to store results. - **Bottom-up:** solves smaller subproblems iteratively using a table. - Too complex for this video but covered in-depth on their website.
@xEveNxThExOdds
@xEveNxThExOdds 3 ай бұрын
one of the best videos on the topic i’ve seen, thank you
@eager_learner
@eager_learner 4 күн бұрын
Very Insightful!! Explained very well, got clear basics of each pattern.
@stanrobertson
@stanrobertson 3 ай бұрын
Thanks for the update, Anna! It is great that you are sharing your experience so that others can have hope.
@KushLemon
@KushLemon 2 ай бұрын
Wtf are you blabbering about?
@ytrg1
@ytrg1 Ай бұрын
Excellent! Thank you so much for this video. All of the data structures can be overwhelming to remember, you breaking them down into categories, with their use cases, and providing templates was so useful.
@sahiljain5979
@sahiljain5979 2 ай бұрын
thanks a lot man. never thought of solving leetcode as templates .this is really helpful.
@nathsai1658
@nathsai1658 2 ай бұрын
Absolutely loved this video! Thanks a lot!
@manishmahajan6094
@manishmahajan6094 2 ай бұрын
wow ! this gave so much clarity
@Website_TV_1
@Website_TV_1 3 ай бұрын
Struggling with LeetCode? Not anymore! 🚀 These 8 patterns and templates are game-changers for tackling even the toughest problems! 🤯 I wish I learned these earlier - it would have saved me HOURS of frustration. If you're aiming to ace your coding interviews, this video is a MUST-WATCH! 🧑‍💻✨ ⚡ Pro tip: Stick around till the end for an epic bonus! 💡 time stamp: 0:00 - Intro 0:49 - Two Pointers 2:29 - Sliding Window 4:20 - Binary Search 7:34 - BFS 10:08 - DFS 13:08 - Backtracking 16:58 - Priority Queue (Heap) 19:01 - Dynamic Programming
@sushibot12
@sushibot12 3 ай бұрын
Thanks for making this.
@iamsaranhere
@iamsaranhere Ай бұрын
Best if the best like 3b1b in Math ,your animations is in whole other league bro for dsa
@PranavRPise
@PranavRPise 2 ай бұрын
This is what I was looking for!
@Aman-xo4yx
@Aman-xo4yx 3 ай бұрын
Very helpful bro!
@brandonbraner
@brandonbraner Ай бұрын
well this video worked, just signed up for the black Friday special :)
@skazahay
@skazahay Ай бұрын
17:54: Does this only apply to solutions where you limit the max size of the heap to k? Couldn’t you use a full-size minHeap, then pop k elements to get the same result of the k smallest numbers? I’m assuming there’s a reasoning behind it that I’m missing. Thank you for the content, this has been very helpful in studying.
@yaphetsgg4934
@yaphetsgg4934 28 күн бұрын
Even I thought of your approach initially but I think it is done this way to save memory and for faster insert & remove operations - O(log k) instead of O(log n), given k < n always. So, for very large values of n and a small value for k, this approach would save significantly on both space and time.
@ricardosilva3482
@ricardosilva3482 2 ай бұрын
Regarding Binary Search for the "Find Minimum in Rotated Sorted Array" problem, I'm a bit unsure if the boolean array approach works. For example, if we have the rotated array of [50, 60, 70, 80, 90, 10, 20, 30, 40], wouldn't the approach return 20 instead of 10?
@unomas-jo7ou
@unomas-jo7ou 7 күн бұрын
Great content
@jaskiratsood1643
@jaskiratsood1643 2 ай бұрын
Thank you so much.
@Salah-YT
@Salah-YT 3 ай бұрын
thank u so much
@pravinprince3221
@pravinprince3221 3 ай бұрын
Thank you so much sir for the wonderful video
@ColeHartman1
@ColeHartman1 25 күн бұрын
Great summary, although the templates are a bit convoluted to me. It should be made easier to visualize at first glance.
@ivmmos
@ivmmos 2 ай бұрын
Much appreciation from self-learner!👍
@existentialism_01
@existentialism_01 Ай бұрын
hey man, am self-learner aswell, wanna collaborate?
@SkandiaAUS
@SkandiaAUS 26 күн бұрын
This is an AI generated voice. It's actually not terrible, and I've seen other videos on this channel and you do know what you're talking about. So why did you decide to go with the generated voice, instead of your own?
@robbyoconnor
@robbyoconnor Ай бұрын
16:38 The background music is a huge mistake... it's very relaxing
@debojitmandal8670
@debojitmandal8670 10 күн бұрын
Hi how much do I need for a data science interview in product based companies
@PanicAtProduction
@PanicAtProduction 3 ай бұрын
Awesome!
@algo.monster
@algo.monster 3 ай бұрын
Thank you! Cheers!
@rohan637
@rohan637 3 ай бұрын
Unable to buy your course from India. It say "Merchant is non-compliant with RBI guidelines for recurring payments and e-mandate". And yes I have international payments on on my card
@algo.monster
@algo.monster 3 ай бұрын
Hey Rohan, thanks so much for letting us know. Which bank are you using? There is an issue with subscription in India since we are a foreign entity. Could you send us an email at support@algo.monster and we can look into it.
@nadeem-cp9is
@nadeem-cp9is 3 ай бұрын
great video
@aliadel1723
@aliadel1723 3 ай бұрын
Best Platform
@Apollon609
@Apollon609 2 ай бұрын
what the fudge are you saying at 9:16
@anandtheertha2775
@anandtheertha2775 7 күн бұрын
😂
@gesuchter
@gesuchter 7 күн бұрын
AI speech?
@IceGamerification
@IceGamerification 3 ай бұрын
where do i check this stuff out again?
@algo.monster
@algo.monster 3 ай бұрын
algo.monster/
@chandantalreja08
@chandantalreja08 3 ай бұрын
Thank you so much
@roushanv
@roushanv 3 ай бұрын
Absolutely, i just don't remember how many times i have been asked binary search like finding indices of the numbers repeated in a sorted array 😂
@GauravSrivastava-c5q
@GauravSrivastava-c5q Ай бұрын
dont know why but feel little bit of confident by seeing some medium level could be solved by patterns
@kishorpustake6682
@kishorpustake6682 Ай бұрын
I can't think logic of an easy leetcode problems can't solve a single easy leetcode problem till now from 2 years I m learning 😖😖😖
@kayalvizhi3624
@kayalvizhi3624 3 ай бұрын
Is any one tell me.. Learning dsa is useful for careee or not?
@algo.monster
@algo.monster 3 ай бұрын
It's probably the single highest return-on-investment activity you could do for a tech career, opens so many doors once we you master it
@AmitNayekamit006
@AmitNayekamit006 2 ай бұрын
In `DFS` function 16:07 path.pop() never execute.
@mobiledevelopmentmastery2024
@mobiledevelopmentmastery2024 2 ай бұрын
Could you share some discount for your subscription?
@TheGIQ123
@TheGIQ123 2 ай бұрын
For the TF question (binary search) you forgot to stipulate that the input only has false, then true (can’t do TFTF) Also, the vocal AI had a hiccup at the 9m mark lmao
@algo.monster
@algo.monster 2 ай бұрын
input has to be monotonic, which mens F(0) cannot go after T(1)
@nishantsharma8824
@nishantsharma8824 3 ай бұрын
but there are no jobs what would i do after learning all this?
@kiprutos
@kiprutos 3 ай бұрын
yes. learning for fun.
@algo.monster
@algo.monster 3 ай бұрын
I hear you-things are tough right now, but the pendulum always swings in both directions. The tech industry (like any other industry) has its ups and downs, but it always picks back up. By building your skills now, you'll be ready to seize opportunities when the market improves. Watch this video on this topic: kzbin.info/www/bejne/b3LJppuknc5kgLM
@ritik4293
@ritik4293 3 ай бұрын
This content was never about learning or memorizing things just for getting jobs , it's something that if you truly understand and are curious about can help you solve problems that can help you create your own company...!
@TheSwden
@TheSwden 3 ай бұрын
This is like multi level preaching. You can teach others and they can teach others and they can teach others....
@TheSwden
@TheSwden 3 ай бұрын
​@@ritik4293kya bhai.. Kuch b
@techenthusiast-q9n
@techenthusiast-q9n Күн бұрын
It feels a little irritating when you are introducing 'algo monster' after each pattern. Having it at the start and then at the end, makes more suitable
@omai225
@omai225 Ай бұрын
This video is very misleading. Important information is left out and some of the examples used don’t really demonstrate the full use of the patterns. The template code is also very clunky. It almost seems like the person narrating the video hasn’t grinded any Leetcode problems before. Is this what you can expect of algomonster?
@crockz0r
@crockz0r Ай бұрын
it's a 20 minutes video, what would you expect?
@omai225
@omai225 Ай бұрын
@ does it being 20 mins change what I said?
@ml_serenity
@ml_serenity 3 ай бұрын
Leetcode has nothing to do with the real-world programming in 99% of cases.
@rickyc46
@rickyc46 2 ай бұрын
Wrong
@ml_serenity
@ml_serenity 2 ай бұрын
@rickyc46 tell me more about it.
@aakashsrivastava5557
@aakashsrivastava5557 2 ай бұрын
Please wake up
@melophylic7469
@melophylic7469 Ай бұрын
I mean when you need to build scalable applications it will be used. Relational databases, pathfinding algorithms, making filters, recommendation algorithms, etc. But non-scalable ones don't really need them ig.
@ml_serenity
@ml_serenity Ай бұрын
@@melophylic7469 Inventing algorithms? Cool. Most of us professional programmers don't ever do that stuff.
It's Really Just That Bad
57:49
ThePrimeTime
Рет қаралды 264 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 792 М.
"Идеальное" преступление
0:39
Кик Брейнс
Рет қаралды 1,4 МЛН
SLIDE #shortssprintbrasil
0:31
Natan por Aí
Рет қаралды 49 МЛН
Какой я клей? | CLEX #shorts
0:59
CLEX
Рет қаралды 1,9 МЛН
GIANT Gummy Worm #shorts
0:42
Mr DegrEE
Рет қаралды 152 МЛН
one year of studying (it was a mistake)
12:51
Jeffrey Codes
Рет қаралды 225 М.
10 weird algorithms
9:06
Fireship
Рет қаралды 1,3 МЛН
8 Data Structures Every Programmer Should Know
17:09
ForrestKnight
Рет қаралды 254 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 241 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 753 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Codebagel
Рет қаралды 346 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 474 М.
"Идеальное" преступление
0:39
Кик Брейнс
Рет қаралды 1,4 МЛН