AMOUNT OF NEW AREA PAINTED EACH DAY | LEETCODE # 2158 | PYTHON SIMPLE SOLUTION

  Рет қаралды 4,115

Cracking FAANG

Cracking FAANG

2 жыл бұрын

In this video we are solving a tricky Google interview question: Amount of New Area Painted Each Day (Leetcode # 2158).
On paper this question looks really easy and it's super simple to draw out a solution that works but putting it into code is much harder. There are some solutions out there that deal with Red-Black trees/Segment Trees but on this channel we opt for simpler, easier to understand solutions instead of the esoteric stuff.

Пікірлер: 14
@koeber99
@koeber99 Жыл бұрын
the time complexity is worst. As example n = 2. [0,100000000],[0,100000000]. The time would be O(n*m), where m is 100000000 m= avg range of start to end. Simply, using an boolean array or Set<Integer> would also get me O(n*M) solution.
@MinhNguyen-lz1pg
@MinhNguyen-lz1pg Жыл бұрын
Love the approach! Just a quick comment on his optimization and why does this help with the run time.
@tsaregrad
@tsaregrad Жыл бұрын
How this is better than the suggested solution in hints? Still N^2 for time. And for space it's actually O(5 * 10^4) for space
@sharathkumar1576
@sharathkumar1576 2 жыл бұрын
Thanks a lot. Your videos make me feel like I'm stepping closer to Google my dream company. Keep making these videos 😀😀. Not even my classmates helped me during college but you are doing it. Thanks a lot man you are God 💞
@yunaf4609
@yunaf4609 2 жыл бұрын
Great explanation! this problem really had me stumped from the discuss section, but your explanation was excellent. Thanks for making this.
@jataman123
@jataman123 2 жыл бұрын
Thanks for this explanation. I implemented it in a similar way, but it fails one last performance test. Can you spot any mistakes?
@agnilasmagicland9672
@agnilasmagicland9672 Жыл бұрын
Very clever. Thank you for the solution.
@keerthivasan9548
@keerthivasan9548 2 жыл бұрын
Is Sorting by start time and overlapping intervals kind of solution works?
@subee128
@subee128
Thank you so much
@roywastaken
@roywastaken Жыл бұрын
make more videos bro, you're underrated af
@ppavantiwari
@ppavantiwari
This will result into TLE
CLOSEST BINARY SEARCH TREE VALUE II | LEETCODE # 272 | PYTHON SOLUTION
14:16
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 29 МЛН
Gym belt !! 😂😂  @kauermotta
00:10
Tibo InShape
Рет қаралды 18 МЛН
No empty
00:35
Mamasoboliha
Рет қаралды 10 МЛН
Opensource, Uncensored, Unbothered. - Flux.1 Image Gen
18:59
MattVidPro AI
Рет қаралды 14 М.
LeetCode 1937. Maximum Number of Points with Cost
18:00
Happy Coding
Рет қаралды 10 М.
MY CALENDAR | LEETCODE 729 | PYTHON SOLUTION
15:46
Cracking FAANG
Рет қаралды 1,8 М.
JPEG is Dying - And that's a bad thing
8:09
2kliksphilip
Рет қаралды 63 М.
LeetCode 1610. Maximum Number of Visible Points
15:59
Happy Coding
Рет қаралды 4,6 М.
DESIGN IN-MEMORY FILE SYSTEM | LEETCODE # 588 | PYTHON SOLUTION
21:37
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 29 МЛН