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

Related Articles

  1. Daily Interview Puzzle: Ways to Traverse a Grid
  2. [Daily Problem] Witness of The Tall People
  3. Algorithm Interview: Convert Roman Numerals to Decimal
  4. Daily Interview Problem: Given two arrays, write a function to compute their intersection.
  5. Reverse a Linked List
  6. First and Last Indices of an Element in a Sorted Array
  7. [Daily Problem] Validate Balanced Parentheses
  8. Daily Interview Puzzle: Intersection of Linked Lists
  9. Algorithm Interview: Smallest Number that is not a Sum of a Subset of List
  10. Daily Interview Problem: Maximum Profit From Stocks

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />