Baseball Game - Leetcode 682 - Python

  Рет қаралды 36,836

NeetCode

NeetCode

Күн бұрын

Пікірлер: 26
@whosBeanie
@whosBeanie 2 жыл бұрын
Hey man I commented a while back when you walked around Seattle talking about your channel and working at google, and I had talked about me interviewing at a few companies including Amazon and I just wanted to let you know I just finished my first week at Amazon and your videos were my favorite resource for LC questions. Thanks man for all you do❤️
@NeetCode
@NeetCode 2 жыл бұрын
That's so great to hear!!! Congrats and good luck :)
@AndreiSokolov-k7j
@AndreiSokolov-k7j 9 ай бұрын
@@kenbarlow9023and do you on the other side now?
@smaa01
@smaa01 2 жыл бұрын
Thanks
@NeetCode
@NeetCode 2 жыл бұрын
Thank you so much!!
@amangaur4231
@amangaur4231 2 жыл бұрын
How r u so much clear in explaining things man :| just love ur videos
@johnj171
@johnj171 6 ай бұрын
really man you are the GodFather of the coding community love you!!! you are great
@numberonep5404
@numberonep5404 2 жыл бұрын
easy prbs are here to boost our ego enough to confront hard prbs xd
@versatile7713
@versatile7713 2 жыл бұрын
I like ur way of explanation man ❤ 👏💯✨
@hdot2613
@hdot2613 8 ай бұрын
I have essentially the same code but I would have referred to it as using a "dynamic array" in conversation as their implementation is identical in python. Is it wrong to call this a Dynamic Array in an interview or is it best to specify that i'm implementing a Stack? If so, when should I use a Stack vs Dynamic Array
@rhosymedra6628
@rhosymedra6628 2 жыл бұрын
I agree, really weird to call it a baseball game! Great explanation as always.
@sanooosai
@sanooosai 9 ай бұрын
thank you
@GaetanoBarreca
@GaetanoBarreca Жыл бұрын
Thanks!
@viggicodes
@viggicodes Жыл бұрын
using switch case which was introduced in python 3.10 class Solution: def calPoints(self, operations: List[str]) -> int: stack = [] for o in operations: match o: case '+': stack.append(stack[-1] + stack[-2]) case 'D': stack.append(stack[-1]*2) case 'C': stack.pop() case _: stack.append(int(o)) return sum(stack)
@abdulraheemsiddiqui9536
@abdulraheemsiddiqui9536 Жыл бұрын
If you store sum variable as well, you would not have to sum again at the end so TC would be O(N) rather than O(2N). I know they are same but still.
@invaders_must_die6730
@invaders_must_die6730 2 жыл бұрын
thank you for the great explanation not only for the solution but for the problem itself!
@jondebosco7478
@jondebosco7478 13 күн бұрын
Cool
@rudreshgowda5867
@rudreshgowda5867 2 жыл бұрын
@NeetCode
@NeetCode 2 жыл бұрын
Thank you so much Rudresh!!!
@aghilannathan8169
@aghilannathan8169 2 жыл бұрын
How is this even a LC question?
@halahmilksheikh
@halahmilksheikh 2 жыл бұрын
This definitely has fizzbuzz vibes to it
@vineethnc8934
@vineethnc8934 2 жыл бұрын
Please explain Leetcode 321
@AmazonIntern
@AmazonIntern Жыл бұрын
hey neetcode! solid solution. I just wanted to point out that there isn't much error checking here. What if there was a symbol other than the ones provided? It would fail of course because converting a character to an int may ruin the summation. Thus, my solution (provided on leetcode through amazonintern), is much better. If anyone needs help please feel free to reach out. I understand leetcode can be intimidating. But don't worry, we were all there at one point, and I remember being there myself back when I was in the first grade. Back then, baseball problem was quite hard, but by the time I was 7 I had it solved with 0ms runtime. I'm 11 now.
@r00ty
@r00ty 8 ай бұрын
isn't it stack[-2] cheating?
@MrRon-jx9vx
@MrRon-jx9vx 7 ай бұрын
stack[len(stack)-2] is the same so naah
@shreyajha1394
@shreyajha1394 2 жыл бұрын
Pin me!! Or i will take your Doughnut...
Backspace String Compare - Leetcode 844 - Python
14:10
NeetCodeIO
Рет қаралды 15 М.
Car Pooling - Leetcode 1094 - Python
14:45
NeetCode
Рет қаралды 26 М.
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,7 МЛН
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 138 МЛН
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 151 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 674 М.
N-Queens - Backtracking - Leetcode 51 - Python
17:51
NeetCode
Рет қаралды 180 М.
Contiguous Array - Leetcode 525 - Python
15:41
NeetCodeIO
Рет қаралды 29 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 330 М.
Google Coding Interview With A Facebook Software Engineer
49:59
Clément Mihailescu
Рет қаралды 946 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 518 М.
Python for Coding Interviews - Everything you need to Know
26:18
Smallest String Starting From Leaf - Leetcode 988 - Python
9:23
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24