文件: root - text - article - 2019 - 11 - course.txt
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1730 次阅读, 18312 次搜索 | 159 个单词
| 浏览 | 博客存档
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1730 次阅读, 18312 次搜索 | 159 个单词
| 浏览 | 博客存档
Hi, here's your problem today. This problem was recently asked by Google:
By the way, check out our NEW project AlgoPro (http://algopro.com) for over 60+ video coding sessions with ex-Google/ex-Facebook engineers.
You are given a hash table where the key is a course code, and the value is a list of all the course codes that are prerequisites for the key. Return a valid ordering in which we can complete the courses. If no such ordering exists, return NULL.
Example:
This input should return the order that we need to take these courses:
['CSC100', 'CSC200', 'CSCS300']
Here's your starting point:
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | 英文 | 主页 | 类别: 计算机科学 | 1730 次阅读, 18312 次搜索 | 159 个单词 By the way, check out our NEW project AlgoPro (http://algopro.com) for over 60+ video coding sessions with ex-Google/ex-Facebook engineers.
You are given a hash table where the key is a course code, and the value is a list of all the course codes that are prerequisites for the key. Return a valid ordering in which we can complete the courses. If no such ordering exists, return NULL.
Example:
{
'CSC300': ['CSC100', 'CSC200'],
'CSC200': ['CSC100'],
'CSC100': []
}
This input should return the order that we need to take these courses:
['CSC100', 'CSC200', 'CSCS300']
Here's your starting point:
def courses_to_take(course_to_prereqs):
# Fill this in.
courses = {
'CSC300': ['CSC100', 'CSC200'],
'CSC200': ['CSC100'],
'CSC100': []
}
print courses_to_take(courses)
# ['CSC100', 'CSC200', 'CSC300']
猜您喜欢...
- Daily Interview Problem: Jump to the End
- Algorithm Interview: Shifted String
- Daily Interview Problem: Buddy Strings
- Algorithm Interview: No Adjacent Repeating Characters
- Autorun.inf Virus Protection
- CVE-2015-8874 - cPanel EasyApache Vulnerabilities
- Daily Interview Puzzle: Falling Dominoes
- Spreadsheet Columns
- Daily Interview Problem: Merge List Of Number Into Ranges
- Palindrome Integers
©2006~2024 牛排过熟 - 0.00808 秒 - 2461.295 KB/s - 46 在线 内存: 491.51 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
牛排怎么做才好吃? | <meta name="机器人" content="不索引, 跟踪" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
评论 (0)
读写完全 - 一般 - 最小 - 表格 - 所有评论 - 统计
当前页暂时没有评论。