LeetCode Day 12 - Last Stone Weight (C++ & Python)

preview_player
Показать описание
Simulate the process of taking two max elements and inserting their difference to a structure.

Subscribe for more educational videos on algorithms, coding interviews and competitive programming.

#Coding #Programming
Рекомендации по теме
Комментарии
Автор

Sorry about struggling with this simple problem. Do you think I should redo a video next time, or do you prefer this format of "solving from scratch without preparation"?

Errichto
Автор

Your approach is perfect. Watching you make mistakes and then debugging them and correcting the code is an even better way to learn.

AshishSingh-dnwb
Автор

Do on the go dude. No need to prepare. Its good to watch this way

stonecoldcold
Автор

Every time I solve the problem, I would come back to your channel to validate my solution. I like the thought process of yours while solving the problem and the way you keep it real. Mistakes makes it more interesting.

Ramesh
Автор

I use Python and watching you solve with both C++ and Python is amazing, please keep doing this where you solve the problems in both C++ and Python

wixisgreasy
Автор

Easiest way is to use a Max heap (priority queue for c++)

sharathnair
Автор

I loved the lambda function, if you were using priority_queue i will not learn something as amazing as that, please continue with speed code in c++

edmundovidana
Автор

Just don't prepare this is awesome for me like really I learn a lot by watching you thinknig on the spot, nobody provide this content but you.
I hope you see this comment.
A lot of other youtuber prepare and do boring and useless videos, but this is unique.

nullnull
Автор

Well, multiset approach isn't that bad, you could go for multiset<int, std:: greater<int>>
This will insert in descending order

To remove only one occurance just do: erase(find(element)).

Complexity O(nlogn)

PiyushKumar-qjue
Автор

I find such types of videos more educational because you make mistakes and then go about fixing it. Watching you do that teaches us about your thought process and how you tackle such questions.

Great Job!

shashwatkhanna
Автор

Thank you for adding Python version! Please start first with Python then C++.
I prefer "solving from scratch without preparation", in this way, we follow you on how to think, we learn the process and we will not be discourage, next time, when we do our own algorithms and see that we struggle and not work from the first try. btw, last days you were at 86k, now after just after adding Python version, you suddenly jumped to 99k

mikemihay
Автор

"100k subscriber very very very soon", you deserved already 1million

brestv
Автор

I love to observe how you think when approaching these problems so I would really appreciate if you can continue solving them without preparation 🙏

imranariffin
Автор

YAY! PYTHON! But I have started to code in C++ lately.

almuhimen
Автор

Always good to see how to debug, I think this is the best approach. Many people always show perfect programs, it's boring to see code always working.

ItumelengS
Автор

4:06

Errichto: "0"... some stupid way to write it
Rust programmers: :|

NEGIgic
Автор

Errichto : Good morning !
Me watching at 3 a.m. : Good morning !

Player-ubtg
Автор

No, this way is better . watching your approach to a problem is amazing.

tac-angry
Автор

I see Python and I subscribe! I love when you show the process and the way you search online.

khmsalhuas
Автор

This way of recording is very good. You are honest.

milanboroja