File: root - text - article - 2020 - 02 - multitasking.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 1194 Views, 25115 Search Bots | 77 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 1194 Views, 25115 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 | 1194 Views, 25115 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
- Progess made
- [Daily Problem] Move Zeros
- Kaprekar
- Daily Interview Problem: Merge Overlapping Intervals
- Daily Interview Problem: Find the k-th Largest Element in a List
- Algorithm Interview: Shifted String
- Making a Height Balanced Binary Search Tree
- Design Tic-Tac-Toe
- Palindrome Integers
- [Daily Problem] Course Prerequisites
©2006~2024 SteakOverCooked - 0.00795 Seconds(s) - 2410.041 KB/s - 35 Online Memory: 492.03 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="index, 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 !