leetcode-13双周赛-1257-最小公共区域
2024-10-07 18:34:25
题目描述:
方法:
class Solution(object):
def findSmallestRegion(self, regions, region1, region2):
parent = {}
for row in regions:
top = row.pop(0)
for bot in row:
parent[bot] = top seen = {region1}
while region1 in parent:
region1 = parent[region1]
seen.add(region1) while region2 not in seen:
region2 = parent[region2]
return region2
最新文章
- asp.net pipeline完整图
- python爬虫学习 —— 总目录
- nyoj 14 会场安排问题(贪心专题)java
- HAST 使用笔记
- CodeForces ZeptoLab Code Rush 2015
- 设置go语言语法高亮
- UVaLive 7362 Farey (数学,欧拉函数)
- pthread_create()之前的属性设置
- JavaScript HTML DOM 元素(节点)
- Elasticsearch和MongoDB分片及高可用对比
- 1.MySQL(一)
- WCF输出JSON
- 转:Override vs Overload
- Gym101194J Mr.Panda and TubeMaster 二分图、费用流
- win10 大文件 安卓android studio修改 汉化
- PyCharm的一些设置
- promise 拙见
- (笔记)linux增加非标波特率的方法
- mybatise 动态sql
- fusionjs uber开源的通用web插件化开发框架