Skip to content

Course Schedule Ii#146

Open
tom4649 wants to merge 2 commits into
mainfrom
210.Course-Schedule-II
Open

Course Schedule Ii#146
tom4649 wants to merge 2 commits into
mainfrom
210.Course-Schedule-II

Conversation

@tom4649

@tom4649 tom4649 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

# 0: 未訪問, 1: 訪問中, 2: 訪問ずみ
status = [0] * numCourses

def dfs(i):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

関数名は通常英単語の原形または命令形、もしくは助動詞などで始まることが多いと思います。また、関数名にはその関数が何をするのか、何が返ってくるのかを表す英単語・英語句を付けることをお勧めいたします。 dfs は実装の詳細に深入りしすぎているように感じます。 visit_course や can_finish_from などはいかがでしょうか?

adjacent_list[first].append(second)

order = []
# 0: 未訪問, 1: 訪問中, 2: 訪問ずみ

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

マジックナンバーとなっているのが気になりました。 enum の仕様をお勧めいたします。
https://docs.python.org/ja/3/library/enum.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants