To the Top
File:  root - text - article - 2020 - 02 - multitasking.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 830 Views, 20774 Search Bots | 77 Words

Subscribe to Feed Burner | 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 | 830 Views, 20774 Search Bots | 77 Words Subscribe to Feed Burner

Related Articles

  1. How to Play WAV music under DOS?
  2. YES!!
  3. Daily Interview Problem: Get all Values at a Certain Height in a Binary Tree
  4. Algorithm Interview Question: Nth Fibonacci Number
  5. CVE-2015-8874 - cPanel EasyApache Vulnerabilities
  6. Daily Interview Problem: Find the k-th Largest Element in a List
  7. PHP Unit Tests on VPS Server
  8. Algorithm Interview Question: Max and Min with Limited Comparisons
  9. Algorithm Interview Question: Find the Single Element in an Array of Duplicates
  10. Reverse a Directed Graph

Comments (0)

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />