Task Scheduler | LeetCode 621 | C++, Java

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

**** Best Books For Data Structures & Algorithms for Interviews:**********
*****************************************************************************

July LeetCoding Challenge | Problem 28 | Task Scheduler | 28 July,
Facebook Coding Interview question,
google coding interview question,
leetcode,
Task Scheduler,
Task Scheduler c++,
Task Scheduler Java,
Task Scheduler python,
Task Scheduler solution,
621. Task Scheduler

#CodingInterview #LeetCode #JulyLeetCodingChallenge #Google #Amazon #TaskScheduler
Рекомендации по теме
Комментарии
Автор

I've watched tons of famous tech youtubers doing leetcode, but yours is by far the best! thanks for taking good amount of time explaining the problems with your own examples, that really helps a lot!

MrSun
Автор

for all those asking about n+1 .. Each cycle consists of n + 1 units of time so that why we loop n+1 .. for example if n=2 so the cycle will be like A->B->Idle which is (n+1) size .. so the for loop is to filling the queue cycle by cycle

osamaelsayed
Автор

this is super awesome. Actually, I was waiting for O(n) time space O(1) explanation.

ijaz
Автор

why n+1 cycles? not explained in depth

GauravKumar-tdpo
Автор

Amazing video. I coudnt solve it on my own. I saw the solutions and most of them were really complicated. Your solution is the easiest to understand. Amazing job and thanks so much for sharing.

ChristianESL
Автор

On line 23 why you are doing n+1, and why not n?

rudhikshah
Автор

While there are many explanations to this problem on YouTube (sometimes even with the same approach), I've found this one to be the best one. It was really useful to see the dry run in a white board first. Congrats! and please keep making your videos with C++!

jlecampana
Автор

I’ve been following you since you started publishing the May LeetCode challenges! Thank you for going into such depth with every problem! I have a technical interview next week and I feel ready because of your video explanations! Keep up the great work!!!😆

ThePaulNguyen
Автор

Was eagerly waiting for this. Thank you so much. :)

ankitatrivedi
Автор

Awesome...simply explained everything. Thankyou

ankitsinha
Автор

hi, I solved this problem without giving regard to which task has higher frequency. I am just scheduling the first available task that is past the cooldown period. All test cases passed. I am using two maps one to keep frequency count and one to track the earliest possible time I can schedule the task next.

dhruvshah
Автор

Intuition explained at every step ! Thank you

c_leet
Автор

I have one query in last line result+= pq.empty() : time : n+1 .. Why are u adding n+1 ?? Suppose we have string AAABBB In first iteration test become 2 ; result becomes 2 ; then test becomes 4 ; then result becomes 4; then test becomes 6; result becomes 6; Now frequency of both A and B have become zero and the queue is empty. So now you are adding n+1 i.e (2+1) to result so it becomes 9 ?? Am i right ?

aviraltandon
Автор

I solved this problem using the same approach where I utilized unordered_map, priority queue, and vector. However, I considered that there might be a better approach

sagarray
Автор

Thank you, Sir<3
Very well explained!

gokulnaathbaskar
Автор

Hi sir, Can you help me to sort process scheduling problem out?

vimalkumar-iwdu
Автор

for adding and removing value in heap takes O(logn), we need to iterate through the array, so the time complexity will be O(nlogn), is it correct ? anyone please explain 🙏🙏🙏...

ManojKumar-vbwm
Автор

Hi, why are we subtracting one from the top element in line 16? we are pushing the pq.top to the tmp vector. But why do you subtract 1 from the top most element?

VenkatIyer
Автор

Thank you so much for doing this challenge series!

henrynguyen
Автор

Thank you for this video and the code in Java!

xueli