Maximum Performance of a Team - Leetcode 1383 - Python

preview_player
Показать описание


0:00 - Read the problem
1:57 - Drawing Explanation
11:10 - Coding Explanation

leetcode 1383

#coding #interview #python
Рекомендации по теме
Комментарии
Автор

I've got my Amazon final interview next Friday and I just wanted to let you know that I wouldn't have made it nearly as far without you. Thank you for all your videos! You have no idea how many lives you're changing

filipjovanovic
Автор

I think it would be great if you could just show us the code for the brute force way also and then go in depth to explain the optimal solution like you usually do. I personally struggle to sometimes code up even the brute force solution so learning how to do that is something I would value a lot.

mukundyadav
Автор

To think I once hated dsa coding, have come a long way loving it now, all thanks to you ❤.

seekndstroy
Автор

I can easily code just after half the video, he explains really good

mickyman
Автор

I also used heap, got to keep the daily streak going!
Thanks for the explanation!

AlgoJS
Автор

2 minutes into the explanation I got the idea, thanks for the video!

aditya-lrin
Автор

although i use C++, this is very well explained!!

mj-lcdb
Автор

This guy can make hard question to easy, keep it up.

sunilpanchal
Автор

The explanation was great, but I do have a question, is it not better to pop the minimum speed from the heap only if the current speed is greater than that minimum speed?

supriyobanerjee
Автор

Thanks for another great video! I have a question about line 11 and 12, At 14:10, when we pop the minimum value from the heap, shouldn't we first check if this minimum speed is less than the current speed i.e. spd? e.g let's say our K=1 and sorted array is like this [[10, 10], [10, 5], [10, 0]], then we should simply keep the first element as we go through the array without popping the heap.

houmankamali
Автор

Isn't size of The Decision Tree be greater than 2^n ??, as 2^n would be the maximum number of nodes present itself on last level ?
(Just asking for sake of my understanding regarding that Exponential Complexity, else I understand the approach totally )

nipunshah
Автор

Fan of your amazing videos! Please keep adding more and more

saidud
Автор

Thank you, this is such a subtle explanation, loved it.

abhishekgururani
Автор

we are popping when len(heap)==k in heap
and adding curr value in heap..what if the current value is smaller than what we had popped?

devendrarana
Автор

Lets say if we sort the array in increasing order of their efficiency then we need two nested for loops right? Correct me if my understanding is wrong

KushalBhatia
Автор

I copied and pasted a lot of stuff and stitched together this code, but I have no idea how it works lol. I knew this could be done with bit manipulation but this method is not any better than the binary search solution, but I still wanted to try it. However, I have no idea how this works except for the msb calculation, which i modified to include (the original did not work).

import math
class Solution:

def mySqrt(self, x: int) -> int:

msb = len(str(bin(x)))


a = 1 << msb
result = 0
while a != 0:

if (result + a) * (result + a) <= x :
result += a

a >>= 1

return result

aisteelmemesforaliving
Автор

Same question. 2542. Maximum Subsequence Score

theSilentPsycho
Автор

Shouldn't it be 'second *largest* value' instead of 'second smallest value' at 4:48?

HyunBinKim-yofx
Автор

can you do yesterdays daily? I'm so confused trying to track the dp array. Or buy and sell stock 3 is good too

hamoodhabibi
Автор

why can't I sort by speed and then maintain a pq by efficiency? at any instant in time the lowest efficiency would be at the top of pq

muhammadhaseeb
visit shbcf.ru