Skip to content

feat: add solutions to lc problem: No.2924 #3817

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

Merged
merged 5 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Solution2.js
  • Loading branch information
yanglbme authored Nov 27, 2024
commit 5f6691842a1c7a19cdebdc3259604fb4fb99743c
4 changes: 1 addition & 3 deletions solution/2900-2999/2924.Find Champion II/Solution2.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
function findChampion(n, edges) {
const vertexes = new Set() < number > Array.from({ length: n }, (_, i) => i);

const vertexes = new Set(Array.from({ length: n }, (_, i) => i));
for (const [_, v] of edges) {
vertexes.delete(v);
}

return vertexes.size === 1 ? vertexes[Symbol.iterator]().next().value : -1;
}
Loading