File: root - text - article - 2020 - 02 - multitasking.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 1213 Views, 25540 Search Bots | 77 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 1213 Views, 25540 Search Bots | 77 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by AirBNB:
We have a list of tasks to perform, with a cooldown period. We can do multiple of these at the same time, but we cannot run the same task simultaneously.
Given a list of tasks, find how long it will take to complete the tasks in the order they are input.
tasks = [1, 1, 2, 1]
cooldown = 2
output: 7 (order is 1 _ _ 1 2 _ 1)
def findTime(arr, cooldown):
# Fill this in.
print findTime([1, 1, 2, 1], 2)
# 7
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 1213 Views, 25540 Search Bots | 77 Words We have a list of tasks to perform, with a cooldown period. We can do multiple of these at the same time, but we cannot run the same task simultaneously.
Given a list of tasks, find how long it will take to complete the tasks in the order they are input.
tasks = [1, 1, 2, 1]
cooldown = 2
output: 7 (order is 1 _ _ 1 2 _ 1)
def findTime(arr, cooldown):
# Fill this in.
print findTime([1, 1, 2, 1], 2)
# 7
Related Articles
- Daily Interview Problem: Word Ordering in a Different Alphabetical Order
- Daily Interview Problem: Distribute Bonuses
- Daily Interview Puzzle: Intersection of Linked Lists
- [Daily Problem] Validate Balanced Parentheses
- Algorithm Interview: String Compression
- Daily Interview Question: Edit Distance
- Most Frequent Subtree Sum
- [Daily Problem] Longest Increasing Subsequence
- Daily Interview Problem: Merge Overlapping Intervals
- Reverse a Directed Graph
©2006~2024 SteakOverCooked - 0.00827 Seconds(s) - 2182.321 KB/s - 36 Online Memory: 491.39 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !