<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KVGHS6G" height="0" width="0" style="display:none;visibility:hidden"></iframe>

StackAdapt计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(3)
OOD(0)
Algorithm(1)
System Design(2)
高频题(0)
Math(0)
全部(3)
OOD(0)
Algorithm(1)
System Design(2)
高频题(0)
Math(0)
1.Design Spotify
2.Implement Song Shuffler
3.Design a Web Crawler
1. Design Spotify
Design the Spotify service focusing on system architecture and functionality.
2. Implement Song Shuffler
Implement a Song Shuffler. Given an input list of songs and a cooldown period, ensure that when shuffle() is called, it returns a song. The cooldown period means that if shuffle() returned a song, that song cannot be returned again until the cooldown has passed. For example, with songs = [1,2,3,4,5] and cooldown = 1, the shuffle() calls might return 1, then 2, then 3, then 1 again. The follow-up question is how you would modify the code if the cooldown is 2 or greater.
3. Design a Web Crawler
Design a Web Crawler with the following constraints: each domain can only be crawled once per second, and different domains have different priorities. How would you ensure that higher priority domains are processed first?