Defuse the Bomb - Leetcode 1652 - Python

  Рет қаралды 9,284

NeetCodeIO

NeetCodeIO

Күн бұрын

Пікірлер: 35
@NeetCodeIO
@NeetCodeIO 2 ай бұрын
I will be taking a break soon (this year). For now, will try to keep going as long as I can. A lot of these I already recorded last week - see the date at 13:50
@AdityaSingh-nn2cd
@AdityaSingh-nn2cd 2 ай бұрын
How can you pre record daily question?
@tchsu1140
@tchsu1140 2 ай бұрын
gogo
@togbot3984
@togbot3984 2 ай бұрын
Don't push yourself too hard! It's essential to prioritize your health over everything else. Remember, taking breaks and resting is a sign of self-care and you of all people deserve it the most.
@NeetCodeIO
@NeetCodeIO 2 ай бұрын
LC usually posts an editorial for problems that will soon be daily problems. You can see it on the homepage feed when youre signed in.
@oldmajor5240
@oldmajor5240 2 ай бұрын
Wow! Is that only transparent to premium users? Btw I love your videos! Make sure to not overwork yourself please!
@Kaung1999
@Kaung1999 2 ай бұрын
King I thought you were taking a break. It’s good to see you make another vid
@floriankubiak7313
@floriankubiak7313 2 ай бұрын
He will not forsake us! (albeit this one was really easy)
@yhbarve
@yhbarve 2 ай бұрын
Damn. He's back already 😂
@hongjieqiu1799
@hongjieqiu1799 2 ай бұрын
Here is an alternative solution that only compares the window size against k once, might be more intuitive for some. Hope it helps! class Solution: def decrypt(self, code: List[int], k: int) -> List[int]: n = len(code) res = [0] * n if k == 0: return res l = 0 curr_sum = 0 for r in range(n + abs(k)): curr_sum += code[r % n] if r - l + 1 == abs(k): if k > 0: res[(l - 1) % n] = curr_sum else: res[(r + 1) % n] = curr_sum curr_sum -= code[l % n] l = (l + 1) % n return res
@ben94_
@ben94_ 2 ай бұрын
The bomb blew up my confidence
@TheRewindRoom
@TheRewindRoom Ай бұрын
😂
@HariPrasad-d2d
@HariPrasad-d2d 2 ай бұрын
Thanks for doing it again😊
@hargovind2776
@hargovind2776 2 ай бұрын
Glad to find this! Thanks
@alexeytsar
@alexeytsar 2 ай бұрын
great explanations, thanks a lot
@business_central
@business_central 2 ай бұрын
good to see you back so fast! Yaaaay!
@vivekmahajan5709
@vivekmahajan5709 2 ай бұрын
loved to see you❤
@hoyinli7462
@hoyinli7462 2 ай бұрын
gd to see ur next leetcode video!
@leeroymlg4692
@leeroymlg4692 2 ай бұрын
this problem should be a medium problem
@Aaron-cp9tt
@Aaron-cp9tt 2 ай бұрын
bro, you are a legend
@apoorvsharma6932
@apoorvsharma6932 2 ай бұрын
Thanks
@devmahad
@devmahad Ай бұрын
thanks :)
@tommasocerruti998
@tommasocerruti998 2 ай бұрын
🐐
@iamheroboss1655
@iamheroboss1655 Ай бұрын
It's may be circular queue method
@priyanshkashyap-nz5lx
@priyanshkashyap-nz5lx 2 ай бұрын
Thanks for defusing the bomb
@shahzodshafizod
@shahzodshafizod 2 ай бұрын
We said goodbye to you yesterday
@arjunc1482
@arjunc1482 2 ай бұрын
Ur back!!
@antm9957
@antm9957 2 ай бұрын
🤝
@dusvn1484
@dusvn1484 2 ай бұрын
Bro it’s 2:28 am in Europe and I’m jumping from my bed to solve problem when I see you upload every day.Your consistent give me motivation love you neet ❤
@drain1635
@drain1635 2 ай бұрын
Goat
@ajaymishra1511
@ajaymishra1511 17 күн бұрын
My solution before watching video ```js function defuse(code:number[], k:number):number[]{ const res = []; let n = code.length; let sum = new Array(code.length).fill(0); for(let i = 0; i < code.length; i++){ sum[i] = (sum[i - 1] ?? 0) + code[i]; } for(let i = 0; i < code.length; i++){ let sumUpTo = i + k res[i] = sumUpTo >= n ? sum[n - 1] - sum[i] + sum[sumUpTo % n] : sum[sumUpTo] - sum[i]; } return res; } function decrypt(code: number[], k: number): number[] { if(k > 0){ return defuse(code, k); } else if(k < 0){ return defuse(code.reverse(), Math.abs(k)).reverse(); } return new Array(code.length).fill(0); }; ````
Minimum Limit of Balls in a Bag - Leetcode 1760 - Python
16:25
NeetCodeIO
Рет қаралды 15 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 786 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 197 М.
Take K of Each Character From Left and Right - Leetcode - Python
17:19
Neighboring Bitwise XOR - Leetcode 2683 - Python
12:10
NeetCodeIO
Рет қаралды 3,1 М.
10 Math Concepts for Programmers
9:32
Fireship
Рет қаралды 2 МЛН
The only Cloud services you actually need to know
17:17
NeetCodeIO
Рет қаралды 212 М.
Rust Functions Are Weird (But Be Glad)
19:52
Logan Smith
Рет қаралды 150 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 787 М.
10 years of coding in 13 minutes
13:28
Joma Tech
Рет қаралды 5 МЛН
How I Approach a New Leetcode Problem (live problem solving)
25:31
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 513 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН