LeetCode Biweekly Contest 19 (2nd) + Explanations

  Рет қаралды 1,484

William Lin

William Lin

Күн бұрын

I started 3 minutes late but still got 2nd! Anyways, explanations start at 10:11. If they are a bit unclear, feel free to ask questions in the comments below so that I can improve!
Bonus: Solve the 2nd problem in O(nlogn), with the modification that you need to count the number of subarrays of any length! (atcoder.jp/con...)
If this video was helpful, be sure to like & subscribe!

Пікірлер: 27
@zqz9112
@zqz9112 2 жыл бұрын
pretty much helpful. Thanks for the clear explanations!
@josephwong2832
@josephwong2832 3 жыл бұрын
love these weekly LC contest explanations!
@himanshusingh3056
@himanshusingh3056 4 жыл бұрын
Bonus question is indeed interesting! Will try..
@akashgupta13
@akashgupta13 4 жыл бұрын
Good work buddy! 🙂
@rohithgupta9672
@rohithgupta9672 4 жыл бұрын
Thanks Lin
@iitnakanpur..
@iitnakanpur.. 4 жыл бұрын
Cool stuff
@yojahuang
@yojahuang 4 жыл бұрын
tmworz
@shashanktiwari4442
@shashanktiwari4442 4 жыл бұрын
You can now get some tshirts from leetcode with ur leetcoins..😀
@kasthurishravankumarhpc
@kasthurishravankumarhpc 4 жыл бұрын
Thank you, sir, an explanation is nice.
@alirezaghey8763
@alirezaghey8763 4 жыл бұрын
Your explanations are great. The whiteboard you use for visualization purposes is also great. Would love if you could solve randomly some leetcode problems and also explain. Have checked some other competitive programmers and they lack your ability to clearly explain your intuition and thought process. Thanks!
@saikat93ify
@saikat93ify 4 жыл бұрын
Can you share the reason we are only relaxing the edges only if it's weight is oo ? We aren't checking if steps[v] > steps[u] + 1 at every step
@tmwilliamlin168
@tmwilliamlin168 4 жыл бұрын
steps[v] > steps[u]+1 is the same as steps[v] >= 1e9 in my bfs
@saikat93ify
@saikat93ify 4 жыл бұрын
@@tmwilliamlin168 What I'm trying to ask is that we reduce the edges from oo to a finite value the first time, but we never relax the edges after that. Is there any reason for this ? That the first time we can visit an edge is the lowest distance for that edge ?
@saikat93ify
@saikat93ify 4 жыл бұрын
@@tmwilliamlin168 Can you please explain the purpose of the clear statement ? I am getting TLE without it ?
@tmwilliamlin168
@tmwilliamlin168 4 жыл бұрын
In this graph, all edge weights are the same, so the first time we visit an edge to v, say u1->v, will always give the lowest distance. If we visit another edge u2->v later on, d[u2] must be >= d[u1], so d[u2]+1 >= d[u1]+1, and we don't need to relax the edge.
@tmwilliamlin168
@tmwilliamlin168 4 жыл бұрын
Consider the array [1, 1, ..., 1]. Without the clear statement, the algorithm becomes O(n^2).
@sumantopal558
@sumantopal558 4 жыл бұрын
Liked, subscribed
@naveenverma2390
@naveenverma2390 4 жыл бұрын
can you explain why am i getting error if put 2 instead of 2.0 in clock angle question for this Your input 3 15 Output 7.00000 Expected 7.50000
LeetCode Biweekly Contest 30 (2nd)
12:50
William Lin
Рет қаралды 53 М.
Winning LeetCode Weekly Contest 201
12:07
William Lin
Рет қаралды 130 М.
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 11 МЛН
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 7 МЛН
Almost Failed MIT Class: My First Semester at MIT
8:26
William Lin
Рет қаралды 407 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 633 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 392 М.
The Most Legendary Programmers Of All Time
11:49
Aaron Jack
Рет қаралды 557 М.
Winning LeetCode Weekly Contest 198
40:27
William Lin
Рет қаралды 112 М.
After 6 Years Of Studying Medicine: Here’s How You Learn Anything
14:06
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 85 М.
Postgres just got even faster
26:42
Hussein Nasser
Рет қаралды 14 М.
Can I Run Youtube Entirely From My Terminal? (No Browser)
15:31
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 11 МЛН