We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Search
- Task Scheduling
- Discussions
Task Scheduling
Task Scheduling
+ 0 comments I like your task scheduling code. Can I integerate this algorithm on my website which is related account deletion
+ 0 comments Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Task Scheduling Problem Solution
+ 0 comments My C++ solution:
map<int,int> mp = {{0,0}}; //d->exceed map<int,int>::iterator maxdif = mp.begin(); //iterator to mp item with most exceed map<int,int>::iterator getIterator(int d) { if (d<=maxdif->first) return maxdif; auto iv = mp.insert({d,0}); auto it =iv.first; if (iv.second) { //new d; auto previt = it; previt--; it->second = previt->second+previt->first-it->first; } return it; } int taskScheduling(int d, int m) { map<int,int>::iterator it = getIterator(d); while (it!=mp.end()) { it->second += m; if (it->second > maxdif->second) { maxdif=it; } it++; } return maxdif->second; }
+ 0 comments Here is the solution of Task Scheduling Click Here
+ 1 comment Can i integrate this challenge on my Scheduling website?
Load more conversations
Sort 46 Discussions, By:
Please Login in order to post a comment