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 😤😤
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 :)
Hi bro. Thanks for the best Leetcode content on UA-cam. 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.
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.
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
Q) 1156. Swap For Longest Repeated Character Substring . Can this be related to your earlier solution of 424. Longest Repeating Character Replacement ?
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 😤😤
Hi Navdeep, Thank you for uploading. Please upload easyish questions as well , it is needed to boost confidence and build the foundation.
No worries brother. There are others too who help us but your explanation is quite exceptional 😅.
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 :)
Hi bro. Thanks for the best Leetcode content on UA-cam. 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.
Can you help us in the previous two binary search questions?
we needed you yesterday and the day before
😘
Okay
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.
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
This leetcode question would be a good plot for an anime
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!
"We are bigger than everybody else" lol
honestly not even reading the description is reasonable they need to hire someone specifically for these problem descriptions
So nice to see ur video again!
we needed you for yesterday and day before yesterday problem sir
indians and chinese love leetcode. why is that?
First! Thank you very much Sir for all your help.
can you please upload videos of leetcode weekly and biweekly also
Thanks for the video.
Thanks a lot as always)
Can you share the solution for 1552. Magnetic Force Between Two Balls
i did prefix sum, worked somehow
where were you yester day brother , I needed you 😐😐
Nice
bro literally missing you few days .... put videos daily
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?
I solved it using Prefix sum + 0/1 Knapsack, but runtime was poor 😐
if grumpy[r] == 1:
1st!
early
Q) 1156. Swap For Longest Repeated Character Substring .
Can this be related to your earlier solution of 424. Longest Repeating Character Replacement ?
Neetcode went on vacation when I needed him the most🥲