Duolingo

avatar 476917
黄黄
8064
26
Duolingo面经:经过一个hackerrank的OA后,拿到了一轮面试;面试官非常的友善,很遗憾面挂了:(
大致的题目如下:

Given a list of orders, find the minimum time to complete the orders in order. Each order takes 1 time slot to complete. There is a cooldown period between the orders of the same type, but no cooldown period between orders of different types. (You have to finish the orders in the original order)
Example 1:
orders = ["fish", "fish", "chips", "fish"]
cooldown = 2
Execution process:
Time 1: fish order
Time 2: fish cooldown
Time 3: fish cooldown
Time 4: fish order
Time 5: chips order, fish cooldown
Time 6: fish cooldown, chips cooldown
Time 7: fish order, chips cooldown
Answer: 7

Followup:本帖隐藏内容需要登录后才能查看。
求大米,感谢!

补充内容 (2020-10-19 03:30):
关于followup的补充:当时面试官问了我两个followup: 1. 如果recipes[“chicken fried rice”]没有"fried rice",即没有multi-level recipe的情况,这种情况答案是15; 2.有的话是18
  • 16
26条回复