Skip to content

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

Open
@lightbluegit

Description

@lightbluegit

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions