We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Friend Circle Queries
- Discussions
Friend Circle Queries
Friend Circle Queries
Sort by
recency
|
91 Discussions
|
Please Login in order to post a comment
ugly but working Java solution:
javascript union-find, using Map instead of Array. easy to understand:
function maxCircle(queries) {
}
modified to prevent memory issues from creating a vector of size 10^9
Has anyone solved this, using disjoint sets, in Go or Python? My Go benchmark using Test 10 takes 2 seconds, yet that test fails when I submit my code.
My Python code is also correct, but runs out of time on Test 10.
I'd hate having to rewrite this in C++.
My Disjoint Set solution. Just a small modification to a dictionnary for the size and parents instead of an array.