Тёмный

Grumpy Bookstore Owner - Leetcode 1052 - Python 

NeetCodeIO
Подписаться 157 тыс.
Просмотров 10 тыс.
50% 1

🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🧑‍💼 LinkedIn: / navdeep-singh-3aaa14161
🐦 Twitter: / neetcode1
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
Problem Link: leetcode.com/problems/grumpy-...
0:00 - Read the problem
0:30 - Drawing Explanation
4:40 - Coding Explanation
leetcode 1052
#neetcode #leetcode #python

Наука

Опубликовано:

 

30 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 40   
@NeetCodeIO
@NeetCodeIO Месяц назад
sorry about missing the last couple problems. whenever i come back to an easyish question, i feel bad cause people are gonna think im dodging the hard ones end of the month is when it gets tough so lets gooooo 😤😤
@adilansari-hq9ge
@adilansari-hq9ge Месяц назад
Hi Navdeep, Thank you for uploading. Please upload easyish questions as well , it is needed to boost confidence and build the foundation.
@akash-kumar737
@akash-kumar737 Месяц назад
No worries brother. There are others too who help us but your explanation is quite exceptional 😅.
@fancypants6062
@fancypants6062 Месяц назад
If you have the time and energy to go back to the bouquet of flowers question, I would really appreciate it. Your channel is great, thank you for what you are doing here :)
@shahzodshafizod
@shahzodshafizod Месяц назад
Hi bro. Thanks for the best Leetcode content on RU-vid. First of all you're the only Indian who speaks without accent, I'd like to here your Indian accent too. Secondly your absence for some period of days is a good experience for those who are dependent of your videos and don't even try to solve problems by themselves.
@sauravsingh4497
@sauravsingh4497 Месяц назад
Can you help us in the previous two binary search questions?
@TheWhiteFlame574
@TheWhiteFlame574 Месяц назад
we needed you yesterday and the day before
@GeetainSaar
@GeetainSaar Месяц назад
😘
@GeetainSaar
@GeetainSaar Месяц назад
Okay
@DebopriyoBasu
@DebopriyoBasu Месяц назад
You post videos at the time I solve daily leetcode problems :) If I get stuck, it's a lot of help. Thanks and keep posting!
@MykolaPavluchynskyi
@MykolaPavluchynskyi Месяц назад
One optimization can be - to do the logic about recalculating max window inside if grumpy[r] - because we only need to recalculate if we find next grumpy == 1. So lines 12-16 - can be in if section. Instead of if we have to use while, but we will do less max comparisons for sure, because we will have amount of max comparisons equals to amount of grumpy days, instead of length of the array.
@laceycodetime
@laceycodetime Месяц назад
This leetcode question would be a good plot for an anime
@chien-yuyeh9386
@chien-yuyeh9386 Месяц назад
So nice to see ur video again!
@bhuvan9956
@bhuvan9956 Месяц назад
"We are bigger than everybody else" lol
@pat777b
@pat777b Месяц назад
This is what I came up with. class Solution: def maxSatisfied(self, customers: List[int], grumpy: List[int], minutes: int) -> int: left = 0 right = minutes - 1 candidate = 0 for i in range(len(customers)): candidate += customers[i]*abs(grumpy[i] - 1) for i in range(left, right+1): candidate += customers[i]*grumpy[i] ans = candidate while right < len(customers) - 1: candidate += customers[right+1]*grumpy[right+1] candidate -= customers[left]*grumpy[left] if candidate > ans: ans = candidate left += 1 right += 1 return ans
@benedictaamoah5310
@benedictaamoah5310 Месяц назад
First! Thank you very much Sir for all your help.
@Moirai0_0
@Moirai0_0 Месяц назад
Thanks for the video.
@timonshannikov6452
@timonshannikov6452 Месяц назад
Thanks a lot as always)
@pastori2672
@pastori2672 Месяц назад
honestly not even reading the description is reasonable they need to hire someone specifically for these problem descriptions
@harshithd9539
@harshithd9539 Месяц назад
we needed you for yesterday and day before yesterday problem sir
@nonefvnfvnjnjnjevjenjvonej3384
@nonefvnfvnjnjnjevjenjvonej3384 Месяц назад
indians and chinese love leetcode. why is that?
@innovativesmartlearning9610
@innovativesmartlearning9610 Месяц назад
can you please upload videos of leetcode weekly and biweekly also
@dilmurodabdusamadov5572
@dilmurodabdusamadov5572 Месяц назад
i did prefix sum, worked somehow
@prajyot2021
@prajyot2021 Месяц назад
what if value 5 from ex 1 was at index 1, then a/c to solution left will removed leaving us with not max customers. Can Someone confirm or correct?
@faelzinhh156
@faelzinhh156 Месяц назад
Nice
@mohammedsuhail.s192
@mohammedsuhail.s192 Месяц назад
bro literally missing you few days .... put videos daily
@mohaimenchowdhury
@mohaimenchowdhury Месяц назад
I solved it using Prefix sum + 0/1 Knapsack, but runtime was poor 😐
@xhero9642
@xhero9642 Месяц назад
Can you share the solution for 1552. Magnetic Force Between Two Balls
@mohanedomer9081
@mohanedomer9081 Месяц назад
where were you yester day brother , I needed you 😐😐
@zorxey3189
@zorxey3189 Месяц назад
grumpy
@tanjilurrahmanjim6507
@tanjilurrahmanjim6507 Месяц назад
if grumpy[r] == 1:
@the-wonderful-day
@the-wonderful-day Месяц назад
1st!
@anonymouslurker313
@anonymouslurker313 Месяц назад
early
@anshumansinha5874
@anshumansinha5874 Месяц назад
Q) 1156. Swap For Longest Repeated Character Substring . Can this be related to your earlier solution of 424. Longest Repeating Character Replacement ?
@RajdeepJadeja
@RajdeepJadeja Месяц назад
Neetcode went on vacation when I needed him the most🥲
Далее
How I would learn Leetcode if I could start over
18:03
Просмотров 383 тыс.
Вопрос Ребром - Субо
49:41
Просмотров 1,3 млн
Path with Maximum Gold - Leetcode 1219 - Python
14:53
why do void* pointers even exist?
8:17
Просмотров 342 тыс.
10 Nooby Mistakes Devs Often Make In Python
24:31
Просмотров 56 тыс.
Subarray Sums Divisible by K - Leetcode 974 - Python
16:41
This Is Why Python Data Classes Are Awesome
22:19
Просмотров 798 тыс.
My Brain after 569 Leetcode Problems
7:50
Просмотров 2,5 млн
Harder Than It Seems? 5 Minute Timer in C++
20:10
Просмотров 162 тыс.
НОВЫЕ ФЕЙК iPHONE 🤯 #iphone
0:37
Просмотров 327 тыс.
#engineering #diy #amazing #electronic #fyp
0:59
Просмотров 2,4 млн