RANGE MODULE | LEETCODE 715 | PYTHON SOLUTION

  Рет қаралды 6,104

Cracking FAANG

Cracking FAANG

Күн бұрын

Problem Link: leetcode.com/problems/range-m...
Discord Link: / discord
This this video we are solving, or should I say re-solving a popular Google interview question: Range Module (Leetcode 715).
This problem is just hard. No way around it. I can see why Google asks this. It's quite a horrendous question and the optimal solution is not something you'll figure out with a 200 IQ. Nonetheless, we are solving it today and hopefully this video helps!
TIMESTAMPS
00:00 Intro
00:30 Example
02:42 Add Range Intuition
06:13 Remove Range Intuition
10:56 Query Range Intuition
14:50 Coding
26:05 Time/Space Complexity
29:00 Outro

Пікірлер: 29
@yantinglai7183
@yantinglai7183 Жыл бұрын
Thank you so much for making these videos! I have been using your channel to prepare for the Google interviews. I feel your frustrations and I this make me feel I am not alone. Google interview questions are not easy, but trying to learn a little bit more day by day is important!
@GiridharaSaiPavanKumarGurram
@GiridharaSaiPavanKumarGurram Ай бұрын
how did it go?
@umeshhbhat
@umeshhbhat 5 ай бұрын
I had tried solving it with the BST. It was pain in the ass, so many edge cases. Asking this question in a interview should be an offense!
@viniciusalves9927
@viniciusalves9927 2 ай бұрын
"Unfortunately, I don't have the 200 IQ to understand the Segment Tree solution" was perfect hahahahaha
@ahmedtremo
@ahmedtremo 2 ай бұрын
Great Explanation, thanks!
@stith_pragya
@stith_pragya Ай бұрын
Thank You So Much for this wonderful video...........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@niyatikhandelwal7017
@niyatikhandelwal7017 14 күн бұрын
Very well explained!
@ziqinwu2337
@ziqinwu2337 2 ай бұрын
Thank you so much!
@apoorvwatsky
@apoorvwatsky Жыл бұрын
Actually this is a perfect candidate for a segment tree with range updates using lazy propagation. If the constraints were around 1e5 or 1e6 it'd be much easier, you probably wouldn't even have to worry about anything but range updates. But it can go up to 1e9 so you've got to be clever with it. Anyway that's what I'm gonna try out. It'll probably take up my day but it's worth it.
@crackfaang
@crackfaang Жыл бұрын
Yea I took one look at the segment tree solutions and two thoughts came to mind: 1). I have no fucking idea what is going on here 2). There’s no way I’m going to be able to explain this coherently even if I do get a clue how the code works 😂
@apoorvwatsky
@apoorvwatsky Жыл бұрын
@@crackfaang yea that's another topic on its own. Segment tree is a prerequisite for it. You can still do point updates in log(n) time, but for this problem there's no way around it, it'd just be nlog(n). Lazy propagation solves this in logarithmic time. First time when I learned about it, I couldn't fucking believe it. Range updates in log(n)? Get the fk outta here! xD
@lavanyam3224
@lavanyam3224 19 күн бұрын
​@@apoorvwatsky were you able to write a solution using segment trees?
@lalitvinde1441
@lalitvinde1441 5 ай бұрын
hey can you make solution of it using segment tree Data structure for better optimisation ?
@crackfaang
@crackfaang 5 ай бұрын
No sorry won't be remaking the video. The segment tree is way overkill here. There should be solutions on LC with the code for that if that's specifically what you are after. I generally try to go for more human understandable solutions. When the optimal is something crazy like some wild DP, segment tree, fenwick tree... I never bother because that's just some bullshit and most people won't understand it (probably me included lol)
@akakartiksaini
@akakartiksaini 6 ай бұрын
Really well explained man!!
@crackfaang
@crackfaang 6 ай бұрын
Glad you liked the video! Make sure to subscribe if you haven't already
@akakartiksaini
@akakartiksaini 5 ай бұрын
@@crackfaang sub from 1k🔥
@azeemansari3517
@azeemansari3517 Жыл бұрын
Getting a type error with the line of code index = bisect.bisect(self.intervals, [left, int(1e9)])
@precisionchoker
@precisionchoker Жыл бұрын
Thanks
@crackfaang
@crackfaang Жыл бұрын
No problem, hope the video was helpful for you
@WoWUndad
@WoWUndad Жыл бұрын
@aaditya_87
@aaditya_87 6 ай бұрын
shhaata
@sharathkumar8338
@sharathkumar8338 Жыл бұрын
Hi I have one doubt. there is this codecamp called scaler academy. They charge 274000 indian rupees (around 3320.07 USD todays' exchange rate). I had logged in to their website for free OS course. Right now their sales team is reaching out to me saying we'll teach you DSA and full stack engineering and guide you in internship grade projects and they have tie ups with 750 companies for jobs and on their website they have posted salaries of their alumnis after they enrolled for their bootcamp. Do you think it is worth it. They are calling me like everyday.
@crackfaang
@crackfaang Жыл бұрын
I personally find boot camps to be a total waste of money and time. Everything you need to know is online for free. All it comes down to is do you have the discipline and work ethic to make it happen or do you need some boot camp to hold your hand through it? And think about who will be teaching you? Are any of these people worthwhile learning from? Most of the time they’ll sell you a dream and let your brain think up some scenario where after 12 weeks you’ll now have a Google job. It doesn’t work that way, there are no hacks, there are no shortcuts. It’s your money and you’re free to do with it as you please but if it were me I’d block their number and save my money.
@sharathkumar8338
@sharathkumar8338 Жыл бұрын
@@crackfaang well they say mentors will be from FAANG types of companies 😅. and could be sidehustle for those SWE's.
@aishwariyaaish8305
@aishwariyaaish8305 Жыл бұрын
U can try S30 ds and algo class to master in dsa which is just $799
@sharathkumar8338
@sharathkumar8338 Жыл бұрын
@@aishwariyaaish8305 what is that?
@aishwariyaaish8305
@aishwariyaaish8305 Жыл бұрын
@@sharathkumar8338 its a 4 months class taken by an Indian in USA, my frnds tried that class and feedback was so good. just try googling s30, they will check your knowledge in any coding by taking a small interview, if you clear that they will admit you for their course. But every penny is worth the course.
DETECT SQUARES | LEETCODE 2013 | PYTHON SOLUTION
15:10
Cracking FAANG
Рет қаралды 980
Path with Minimum Effort - Leetcode 1631 - Python
14:35
NeetCodeIO
Рет қаралды 13 М.
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 7 МЛН
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 18 МЛН
Cool Items! New Gadgets, Smart Appliances 🌟 By 123 GO! House
00:18
123 GO! HOUSE
Рет қаралды 17 МЛН
Detonate the Maximum Bombs - Leetcode 2101 - Python
11:20
NeetCodeIO
Рет қаралды 12 М.
Parallel Courses III - Leetcode 2050 - Python
11:42
NeetCodeIO
Рет қаралды 15 М.
Rotate Array | Leetcode Top Interview 150
3:15
Coding Interview Practice With Anurag
Рет қаралды 4
Memoization theory
6:56
Nickvash Kani
Рет қаралды 29
Container with Most Water - Leetcode 11 - Python
12:37
NeetCode
Рет қаралды 307 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 624 М.
2268. Minimum Number of Keypresses
7:18
Just Coding, with Jie
Рет қаралды 173
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 1,1 МЛН
Что делать если в телефон попала вода?
0:17
Лена Тропоцел
Рет қаралды 1,7 МЛН
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,8 МЛН
iPhone, Galaxy или Pixel? 😎
0:16
serg1us
Рет қаралды 926 М.
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 7 МЛН