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.
Jim and his LAN Party
Jim and his LAN Party
Sort by
recency
|
17 Discussions
|
Please Login in order to post a comment
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Jim and his LAN Party Solution
Here is the solution of Jim and his LAN Party Click here
Here is problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-jim-and-his-FAN-problem-solution.html
def find_wire(m, q, games, wires): # Create a union-find set uf = UnionFind(m)
Union-find set class
class UnionFind: def init(self, n): self.parent = [i for i in range(n)] self.size = [1] * n
Read input
m, n, q = map(int, input().split()) games = list(map(int, input().split())) wires = [tuple(map(int, input().split())) for _ in range(q)]
Find the wire
find_wire(m, q, games, wires)
Python3 solution