简体中文
Telegram

帖子def find(parent, u):

2024年8月7日
M
Machine Learning coder
def find(parent, u): if parent[u] != u: parent[u] = find(parent, parent[u]) return parent[u] def unite(parent, rank, u, v): root_u = find(parent, u) root_v = find(parent, v) if root_u != root_v: if rank[root_u] > rank[root_v]: parent[root_v] = root_u elif rank[root_u] < rank[root_v]: parent[root_u] = root_v else: parent[root_v] = root_u rank[root_u] += 1 def solve(n, edges): edges.sort(key=lambda x: x[2]) parent = list(range(n + 1)) rank = [0] * (n + 1) cost = 0 edges_used = 0 for u, v, c in edges: if find(parent, u) != find(parent, v): unite(parent, rank, u, v) cost += c edges_used += 1 if edges_used == n - 1: break return cost Break and Add ✅ #Google
1 · 1.8K ·

信息流中的邻近内容

MMachine Learning coderdef solve(A, N, M, L, x): B = A[:] op = 0 for i in range(N): if B[i] > x: dec = B[i] - x length = min(L, N - i) for j in range(lenMMachine Learning coderdef findMinChanges(taskDependency): n = len(taskDependency) changes = 0 final_task = -1 for i in range(n): if taskDependency[i] == i + 1: final_task = i + 1
这条消息
MMachine Learning coderWho wins the game ✅ Contact: @mlcoder2 #GoogleMMachine Learning coderGot selected in Accenture 🥳🥳🥳 100% clear for any Company with interview interview Guidance ✅ Contact: @mlcoder2

来自搜索索引的公开信息流 ChatCrawler ——“公开 Telegram 的 Google”;随着该社群被抓取而更新。 时间为 UTC。

仅限公开内容,使用 Telegram 官方 API。 关于 · 常见问题 · 索引限制 · 移除页面 · 目录 · 搜索 · 计算方法