Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码随想录-有向图的完全可达性:c++代码完全可达的情况下没有return 0; #2922

Open
lightbluegit opened this issue Mar 18, 2025 · 1 comment

Comments

@lightbluegit
Copy link

for (int i = 1; i <= n; i++) {
if (visited[i] == false) {
cout << -1 << endl;
return 0;
}
}
cout << 1 << endl;
BFS和DFS都是这样的,是否加上return 0;更安全一点?

@lightbluegit
Copy link
Author

代码随想录-冗余连接-思路 第二行“这里我依然降调一下...”,是不是“强调”?

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

No branches or pull requests

1 participant