Рет қаралды 12,538
Whatsapp Community Link : www.whatsapp.com/channel/0029...
This is the 14th Video of our Playlist "Heap (Priority Queue) : Popular Interview Problems".
In this video we will try to solve a very good and famous heap problem : Task Scheduler | Easy Intuition | Using Heap | Leetcode 621 | codestorywithMIK
NOTE - I will make a separate video for discussing another very good Greedy Approach for this problem.
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Task Scheduler | Easy Intuition | Using Heap | Leetcode 621 | codestorywithMIK
Company Tags : META
My solutions on Github(C++ & JAVA) : github.com/MAZHARMIK/Intervie...
GfG Problem Link : leetcode.com/problems/task-sc...
My DP Concepts Playlist : • Roadmap for DP | How t...
My Graph Concepts Playlist : • Graph Concepts & Qns -...
My Recursion Concepts Playlist : • Introduction | Recursi...
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Intervie...
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
Subscribe to my channel : / @codestorywithmik
Approach Summary : Simply use a greedy approach and get rid of tasks having max frequency so that we don't have to deal with them alone at last.Story frequency in max-heap. Start processing n+1 tasks(in descending order form max-heap) everytime and reduce the frequency of tasks by 1. If they are still remaining, push them back to heap.And keep calculating the time for processing the tasks. Once the heap is empty. Return the total time taken.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Timelines
00:00 - Introduction
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #newyear2024