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

  Рет қаралды 138,141

AlgoMonster

AlgoMonster

Күн бұрын

Пікірлер: 78
@yashshukla1637
@yashshukla1637 2 ай бұрын
- **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 2 ай бұрын
one of the best videos on the topic i’ve seen, thank you
@ytrg1
@ytrg1 22 күн бұрын
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 Ай бұрын
thanks a lot man. never thought of solving leetcode as templates .this is really helpful.
@stanrobertson
@stanrobertson 2 ай бұрын
Thanks for the update, Anna! It is great that you are sharing your experience so that others can have hope.
@KushLemon
@KushLemon Ай бұрын
Wtf are you blabbering about?
@nathsai1658
@nathsai1658 Ай бұрын
Absolutely loved this video! Thanks a lot!
@manishmahajan6094
@manishmahajan6094 Ай бұрын
wow ! this gave so much clarity
@skazahay
@skazahay 3 күн бұрын
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.
@iamsaranhere
@iamsaranhere Күн бұрын
Best if the best like 3b1b in Math ,your animations is in whole other league bro for dsa
@sushibot12
@sushibot12 2 ай бұрын
Thanks for making this.
@PranavRPise
@PranavRPise Ай бұрын
This is what I was looking for!
@Aman-xo4yx
@Aman-xo4yx 2 ай бұрын
Very helpful bro!
@ricardosilva3482
@ricardosilva3482 Ай бұрын
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?
@brandonbraner
@brandonbraner 23 күн бұрын
well this video worked, just signed up for the black Friday special :)
@ivmmos
@ivmmos Ай бұрын
Much appreciation from self-learner!👍
@existentialism_01
@existentialism_01 13 күн бұрын
hey man, am self-learner aswell, wanna collaborate?
@jaskiratsood1643
@jaskiratsood1643 Ай бұрын
Thank you so much.
@pravinprince3221
@pravinprince3221 2 ай бұрын
Thank you so much sir for the wonderful video
@Salah-YT
@Salah-YT 2 ай бұрын
thank u so much
@Website_TV_1
@Website_TV_1 2 ай бұрын
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
@Apollon609
@Apollon609 Ай бұрын
what the fudge are you saying at 9:16
@IceGamerification
@IceGamerification 2 ай бұрын
where do i check this stuff out again?
@algo.monster
@algo.monster 2 ай бұрын
algo.monster/
@rohan637
@rohan637 2 ай бұрын
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 2 ай бұрын
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.
@PanicAtProduction
@PanicAtProduction 2 ай бұрын
Awesome!
@algo.monster
@algo.monster 2 ай бұрын
Thank you! Cheers!
@aliadel1723
@aliadel1723 2 ай бұрын
Best Platform
@robbyoconnor
@robbyoconnor 19 күн бұрын
16:38 The background music is a huge mistake... it's very relaxing
@nadeem-cp9is
@nadeem-cp9is 2 ай бұрын
great video
@kayalvizhi3624
@kayalvizhi3624 2 ай бұрын
Is any one tell me.. Learning dsa is useful for careee or not?
@algo.monster
@algo.monster 2 ай бұрын
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
@chandantalreja08
@chandantalreja08 2 ай бұрын
Thank you so much
@kishorpustake6682
@kishorpustake6682 19 сағат бұрын
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 😖😖😖
@nishantsharma8824
@nishantsharma8824 2 ай бұрын
but there are no jobs what would i do after learning all this?
@datastatacian
@datastatacian 2 ай бұрын
yes. learning for fun.
@algo.monster
@algo.monster 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
This is like multi level preaching. You can teach others and they can teach others and they can teach others....
@TheSwden
@TheSwden 2 ай бұрын
​@@ritik4293kya bhai.. Kuch b
@roushanv
@roushanv 2 ай бұрын
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 😂
@AmitNayekamit006
@AmitNayekamit006 Ай бұрын
In `DFS` function 16:07 path.pop() never execute.
@mobiledevelopmentmastery2024
@mobiledevelopmentmastery2024 Ай бұрын
Could you share some discount for your subscription?
@GauravSrivastava-c5q
@GauravSrivastava-c5q 27 күн бұрын
dont know why but feel little bit of confident by seeing some medium level could be solved by patterns
@TheGIQ123
@TheGIQ123 Ай бұрын
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 Ай бұрын
input has to be monotonic, which mens F(0) cannot go after T(1)
@ml_serenity
@ml_serenity 2 ай бұрын
Leetcode has nothing to do with the real-world programming in 99% of cases.
@rickyc46
@rickyc46 Ай бұрын
Wrong
@ml_serenity
@ml_serenity Ай бұрын
@rickyc46 tell me more about it.
@aakashsrivastava5557
@aakashsrivastava5557 Ай бұрын
Please wake up
@melophylic7469
@melophylic7469 23 күн бұрын
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 22 күн бұрын
@@melophylic7469 Inventing algorithms? Cool. Most of us professional programmers don't ever do that stuff.
@omai225
@omai225 8 күн бұрын
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 15 сағат бұрын
@ does it being 20 mins change what I said?
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 731 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
How I Mastered Data Structures and Algorithms in 8 Weeks
15:46
Aman Manazir
Рет қаралды 132 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 459 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 211 М.
From 2.6 GPA to $200K Microsoft Software Engineer
17:21
Sundas Khalid
Рет қаралды 114 М.
You (developer) are BIGGER than your Tech Job!
12:45
Travis Media
Рет қаралды 54 М.
This Flowchart Solves LeetCode Problems for You! 🤯
17:40
AlgoMonster
Рет қаралды 38 М.
8 Data Structures Every Programmer Should Know
17:09
ForrestKnight
Рет қаралды 213 М.
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Codebagel
Рет қаралды 322 М.
8 Design Patterns | Prime Reacts
22:10
ThePrimeTime
Рет қаралды 445 М.
before you code, learn how computers work
7:05
Low Level
Рет қаралды 561 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН