Skip to content

Commit

Permalink
更新图解,添加两种特殊情况
Browse files Browse the repository at this point in the history
  • Loading branch information
EndlessCheng committed Aug 3, 2024
1 parent 24f8c34 commit 1a0c723
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion leetcode/weekly/408/d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

需要注意,本题没有保证圆心一定在矩形内部,如何处理这种情况呢?

![lc3235-c.png](https://pic.leetcode.cn/1722577942-JcJHCE-lc3235-c.png)
![lc3235-c.png](https://pic.leetcode.cn/1722649636-dihkoU-lc3235-c.png)

注:把两圆的两个交点连起来,该线段与 $O_1O_2$ 相交得到的交点作为点 $A$ 也可以,但这种情况点 $A$ 横纵坐标的分母会是一个 $10^{18}$ 数量级的数,在与 $\textit{X}$ 或 $\textit{Y}$ 相乘时会产生 $10^{27}$ 数量级的数,超出了 64 位整数的范围,需要用大整数实现,更麻烦。

Expand Down Expand Up @@ -214,6 +214,8 @@ func abs(x int) int { if x < 0 { return -x }; return x }
- 时间复杂度:$\mathcal{O}(n^2)$,其中 $n$ 是 $\textit{circles}$ 的长度。
- 空间复杂度:$\mathcal{O}(n)$。

注:本题也可以用并查集实现,但效率不如 DFS。

更多相似题目,见下面图论题单中的「**DFS**」和数据结构题单中的「**并查集**」。

## 分类题单
Expand Down

0 comments on commit 1a0c723

Please sign in to comment.