Skip to content

Commit

Permalink
feat: 使用新浪图床
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifer committed Aug 10, 2020
1 parent e97d8ef commit bb2a96f
Show file tree
Hide file tree
Showing 160 changed files with 414 additions and 414 deletions.
16 changes: 8 additions & 8 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

---

![leetcode.jpeg](./assets/leetcode.jpeg)
![leetcode.jpeg](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwf4xivj30dw0780sm.jpg)

This essay records the course of and my emotion to this project from initialization to 10,000 stars.
[Milestone for 10,000+ stars](./thanksGiving.md)
Expand All @@ -22,7 +22,7 @@ If you are interested in this project, **do not mean your star**. This project w

## Introduction

![leetcode.jpeg](./assets/leetcode.jpeg)
![leetcode.jpeg](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwf4xivj30dw0780sm.jpg)

LeetCode Solutions: A Journey of Problem Solving.

Expand Down Expand Up @@ -55,7 +55,7 @@ If you want to do some contributions or collaborations, just feel free to contac
- Here will be the place to update Anki Flashcards in the future as well.
- Here is a mind mapping graph showing the summary of categorizations of problems that are questioned frequently in interviews. We could analyze according to the information in the graph.

![leetcode-zhihu](./assets//leetcode-zhihu.jpg)
![leetcode-zhihu](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwgi53bj30k00jx0te.jpg)

(Picture credited by [LeetCode-cn](https://www.zhihu.com/question/24964987/answer/586425979).)

Expand All @@ -80,15 +80,15 @@ The data structures mainly include:

[0547.friend-circles](./problems/547.friend-circles-en.md) :

![friend circle BFS](./assets/problems/547.friend-circle-bfs.png)
![friend circle BFS](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwh1getj30u0140tdc.jpg)

[backtrack problems](./problems/90.subsets-ii-en.md):

![backtrack](./assets/problems/backtrack.png)
![backtrack](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwhwowgj30n20nptas.jpg)

[0454.4-sum-ii](./problems/454.4-sum-ii.en.md) :

![454.4-sum-ii](./assets/problems/454.4-sum-ii.png)
![454.4-sum-ii](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwivf65j30le0deab3.jpg)

## Portals

Expand Down Expand Up @@ -173,11 +173,11 @@ We're still on the early stage, so feedback from community is very welcome. For

### QQ (For China Region)

![qq-group-chat](./assets/qq-group-chat.png)
![qq-group-chat](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwje9plj3060060wel.jpg)

### WeChat (For China Region)

![wechat-group-chat](./assets/wechat-group-chat.jpeg)
![wechat-group-chat](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwjrk6ij30e80e875j.jpg)

(Add this bot and reply "leetcode" to join the group.)

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

---

![leetcode.jpeg](./assets/leetcode.jpeg)
![leetcode.jpeg](https://tva1.sinaimg.cn/large/007S8ZIlly1ghluelm27rj30dw0780sm.jpg)

- 2019-07-10 :[纪念项目 Star 突破 1W 的一个短文](./thanksGiving.md), 记录了项目的"兴起"之路,大家有兴趣可以看一下,如果对这个项目感兴趣,请**点击一下 Star**, 项目会**持续更新**,感谢大家的支持。

Expand All @@ -29,7 +29,7 @@
- 2020-04-12: [项目突破三万 Star](./thanksGiving3.md)
- 2020-04-14: 官网`力扣加加`上线啦 💐💐💐💐💐,有专题讲解,每日一题,下载区和视频题解,后续会增加更多内容,还不赶紧收藏起来?地址:http://leetcode-solution.cn/

![](https://tva1.sinaimg.cn/large/007S8ZIlly1gdvenxvjlsj30z90dtdhw.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghluemaoj3j30z90dtmy5.jpg)

## 非科学人士看过来

Expand Down Expand Up @@ -85,7 +85,7 @@ leetcode 题解,记录自己的 leetcode 解题之路。

- 这里有一张互联网公司面试中经常考察的问题类型总结的思维导图,我们可以结合图片中的信息分析一下。

![leetcode-zhihu](./assets//leetcode-zhihu.jpg)
![leetcode-zhihu](https://tva1.sinaimg.cn/large/007S8ZIlly1ghluennxvrj30k00jx0te.jpg)

(图片来自 leetcode)

Expand All @@ -110,7 +110,7 @@ leetcode 题解,记录自己的 leetcode 解题之路。

[0042.trapping-rain-water](./problems/42.trapping-rain-water.md):

![0042.trapping-rain-water](./assets/problems/42.trapping-rain-water-1.png)
![0042.trapping-rain-water](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlueqdwy3j30bg04hmx3.jpg)

[0547.friend-circles](./problems/547.friend-circles-en.md):

Expand Down Expand Up @@ -375,11 +375,11 @@ anki - 文件 - 导入 - 下拉格式选择“打包的 anki 集合”,然后

- [每日一题汇总](./daily/)

![每日一题汇总](./assets/daily-summary.png)
![每日一题汇总](https://tva1.sinaimg.cn/large/007S8ZIlly1ghluequftmj30p80nrmzc.jpg)

- [每日一题认领区](https://github.com/azl397985856/leetcode/projects/1)

![每日一题认领区](./assets/daily-board.png)
![每日一题认领区](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlues83n0j315f0i8gug.jpg)

### 计划

Expand Down
2 changes: 1 addition & 1 deletion daily/2019-06-27.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function sqrt(num) {
也就是说,函数上任一点(x,f(x))处的切线斜率是2x。
那么,x-f(x)/(2x)就是一个比x更接近的近似值。代入 f(x)=x^2-a得到x-(x^2-a)/(2x),也就是(x+a/x)/2。

![2019-06-27](../assets/daily/2019-06-27.gif)
![2019-06-27](https://tva1.sinaimg.cn/large/007S8ZIlly1ghludzm5xsg30ip0dct9s.gif)

(图片来自Wikipedia)

Expand Down
2 changes: 1 addition & 1 deletion daily/2019-07-10.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

这个题目解释起来比较费劲,我在网上找了一个现成的图来解释一下:

![weight-ball](../assets/daily/weight-ball.jpg)
![weight-ball](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlue317j6j30d80dcta4.jpg)

图中“1+”是指“1号小球为重”这一可能性。“1-”是指“1号小球为轻”这一可能性。
一开始一共有24种可能性。
Expand Down
2 changes: 1 addition & 1 deletion daily/2019-07-23.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
```

![2019-07-23](../assets/daily/2019-07-23.jpeg)
![2019-07-23](https://tva1.sinaimg.cn/large/007S8ZIlly1ghludxwb1aj30py1hc0tr.jpg)

## 参考答案

Expand Down
2 changes: 1 addition & 1 deletion daily/2019-07-26.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## 题目描述

![2019-07-26](../assets/daily/2019-07-26.jpeg)
![2019-07-26](https://tva1.sinaimg.cn/large/007S8ZIlly1ghludytrtlj30py1hcas1.jpg)

## 参考答案

Expand Down
2 changes: 1 addition & 1 deletion daily/2019-07-29.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Example 2:
2. row->col、col->row 的切换都伴随读取的初始位置的变化;
3. 结束条件是row头>row尾或者col顶>col底

![剥洋葱](../assets/problems/54.spiral-matrix.jpg)
![剥洋葱](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlue0ni96j30b00bdq35.jpg)

时间复杂度O(m*n), 空间复杂度O(1)

Expand Down
2 changes: 1 addition & 1 deletion daily/2019-07-30.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
那么沿着这条纬线(记为E纬线)上任意一点向东走一英里,始终会回到原点,只是走的圈数不同而已。
根据题目倒推,在这条纬线以北一英里存在一条纬线(记为N纬线),从N纬线的任意一点向南一英里到达E纬线W点,沿着E纬线向东一英里,必会回到W点,再向北走一英里恰好可以回到起点。北极点可能包含在这个集合中,也可能不在。
如下图示供参考:
![earth-problem](../assets/daily/2019-07-30.jpg)
![earth-problem](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlue5gt6uj30u01441l0.jpg)

所以答案是无数个点

Expand Down
2 changes: 1 addition & 1 deletion daily/2019-08-13.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ m 和 n =150,肯定超时。

最后将探测结果进行合并即可。合并的条件就是当前单元既能流入太平洋又能流入大西洋。

![集合](https://user-images.githubusercontent.com/5937331/63209454-7c921a80-c113-11e9-8d74-82d0476b8828.png)
![集合](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlue21s7aj30dw08cglo.jpg)
扩展:

如果题目改为能够流入大西洋或者太平洋,我们只需要最后合并的时候,条件改为求或即可
Expand Down
6 changes: 3 additions & 3 deletions problems/101.symmetric-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ https://leetcode-cn.com/problems/symmetric-tree/

看到这题的时候,我的第一直觉是 DFS。然后我就想:`如果左子树是镜像,并且右子树也是镜像,是不是就说明整体是镜像?`。经过几秒的思考, 这显然是不对的,不符合题意。

![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfbmeoo45bj31200iuabh.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu96e83wj31200iugme.jpg)

很明显其中左子树中的节点会和右子树中的节点进行比较,我把比较的元素进行了颜色区分,方便大家看。

Expand All @@ -52,7 +52,7 @@ https://leetcode-cn.com/problems/symmetric-tree/

这种方法可行,但是需要 N 的空间(N 为节点总数)。我想到如果两者可以同时进行遍历,是不是就省去了哈希表的开销。

![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfbso8u6myj31a30u0tf5.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu9a7sy7j31a30u0408.jpg)

如果不明白的话,我举个简单例子:

Expand Down Expand Up @@ -112,4 +112,4 @@ class Solution:

大家也可以关注我的公众号《脑洞前端》获取更多更新鲜的 LeetCode 题解

![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfaq00p8stj30x20iw7b0.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu9b4p9ej30x20iwjtf.jpg)
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ L + M <= A.length <= 1000

题目中要求在前N(数组长度)个数中找出长度分别为L和M的非重叠子数组之和的最大值, 因此, 我们可以定义数组A中前i个数可构成的非重叠子数组L和M的最大值为SUMM[i], 并找到SUMM[i]和SUMM[i-1]的关系, 那么最终解就是SUMM[N]. 以下为图解:

![1031.Maximum Sum of Two Non-Overlapping Subarrays](../assets/problems/1031.maximum-sum-of-two-non-overlapping-subarrays.png)
![1031.Maximum Sum of Two Non-Overlapping Subarrays](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu02o63mj30iz0m9420.jpg)

## 关键点解析

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ If you can't figure out how to get the index of the left and right child, please
- according to the properties of preoder traversal, all right sub-tree nodes are behine all left sub-tree nodes. The length of left sub-tree can help us to divide left and right sub-trees.
- the length of left sub-tree can be find in the inorder traversal. The location of current node is `inRoot`(or whatever your call it). The start index of current inorder array is `inStart`(or whatever your call it). So, the lenght of the left sub-tree is `leftChldLen = inRoot - inStart`.

![explain](../assets/problems/105.index_explain.jpg)
![explain](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltyu9s05j30o00hnq4y.jpg)

## 代码/Code

Expand Down
2 changes: 1 addition & 1 deletion problems/108.convert-sorted-array-to-binary-search-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/

形象一点来看就像你提起一根绳子,从中点提的话才能使得两边绳子长度相差最小。

![image.png](https://pic.leetcode-cn.com/c24c2280aff65bfa06f94dc000bd7475a100903e5c889ee6ebafa014fd63fe3e-image.png)
![image.png](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltysdgtvj30nj0hv3z2.jpg)

## 关键点

Expand Down
6 changes: 3 additions & 3 deletions problems/11.container-with-most-water.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ https://leetcode-cn.com/problems/container-with-most-water/description/
说明:你不能倾斜容器,且 n 的值至少为 2。


![11.container-with-most-water-question](../assets/problems/11.container-with-most-water-question.jpg)
![11.container-with-most-water-question](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu4wyztmj30m90anwep.jpg)


图中垂直线代表输入数组 [1,8,6,2,5,4,8,3,7]。在此情况下,容器能够容纳水(表示为蓝色部分)的最大值为 49。
Expand Down Expand Up @@ -62,7 +62,7 @@ return max;

如图:

![11.container-with-most-water](../assets/problems/11.container-with-most-water.png)
![11.container-with-most-water](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu4xr7ovj30bm0gct9b.jpg)

比如我们计算 n 面积的时候,假如左侧的线段高度比右侧的高度低,那么我们通过左移右指针来将长度缩短为 n-1 的做法是没有意义的,
因为`新的形成的面积变成了(n-1) * heightOfLeft 这个面积一定比刚才的长度为 n 的面积 (n * heightOfLeft) 小`
Expand Down Expand Up @@ -154,4 +154,4 @@ class Solution:
关注公众号力扣加加,努力用清晰直白的语言还原解题思路,并且有大量图解,手把手教你识别套路,高效刷题。


![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfcuzagjalj30p00dwabs.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu4yqnsgj30p00dwt9t.jpg)
8 changes: 4 additions & 4 deletions problems/1104.path-in-zigzag-labelled-binary-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ https://leetcode-cn.com/problems/path-in-zigzag-labelled-binary-tree/description

而偶数行(即,第二行、第四行、第六行……)中,按从右到左的顺序进行标记。

![](https://tva1.sinaimg.cn/large/006tNbRwgy1gaihhb1ysbj310p0gu3zx.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu59hpv3j310p0gumxz.jpg)

给你树上某一个节点的标号 label,请你返回从根节点到该标号为 label 节点的路径,该路径是由途经的节点标号所组成的。

Expand All @@ -37,17 +37,17 @@ https://leetcode-cn.com/problems/path-in-zigzag-labelled-binary-tree/description

如果是这样的话,这道题应该是 easy 难度,代码也不难写出。我们继续考虑之字形。我们不妨先观察一下,找下规律。

![](https://tva1.sinaimg.cn/large/006tNbRwly1gaihn0ktanj30lu093gme.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu5au9j8j30lu093gmm.jpg)

以上图最后一行为例,对于 15 节点,之字变换之前对应的应该是 8 节点。14 节点对应的是 9 节点。。。

全部列举出来是这样的:

![](https://tva1.sinaimg.cn/large/006tNbRwly1gaihota82cj30mk0b6wfp.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu5d6os7j30mk0b6wfw.jpg)

我们发现之字变换前后的 label 相加是一个定值。

![](https://tva1.sinaimg.cn/large/006tNbRwly1gaihpnlpicj309b08dmxl.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu5f240wj309b08dmxj.jpg)

因此我们只需要求解出每一层的这个定值,然后减去当前值就好了。(注意我们不需要区分偶数行和奇数行)
问题的关键转化为求解这个定值,这个定值其实很好求,因为每一层的最大值和最小值我们很容易求,而最大值和最小值的和正是我们要求的这个数字。
Expand Down
2 changes: 1 addition & 1 deletion problems/113.path-sum-ii.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Return:

我们先来看下通用解法的解题思路,我画了一张图:

![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfyrnqi82ej31190u0e81.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltwyr0bkj31190u0jw4.jpg)

> 图是 [78.subsets](https://github.com/azl397985856/leetcode/blob/master/problems/78.subsets.md),都差不多,仅做参考。
Expand Down
16 changes: 8 additions & 8 deletions problems/1131.maximum-of-absolute-value-expression.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ https://leetcode-cn.com/problems/maximum-of-absolute-value-expression/descriptio

> 红色竖线表示的是绝对值的符号
![](https://tva1.sinaimg.cn/large/006tNbRwly1gamo3dx1bej30q003y74f.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu154cgej30q003y3yv.jpg)

我们对其进行分类讨论,有如下八种情况:

Expand All @@ -45,7 +45,7 @@ https://leetcode-cn.com/problems/maximum-of-absolute-value-expression/descriptio
> |i - j| 两种情况
> 因此一共是 2 \* 2 \* 2 = 8 种
![](https://tva1.sinaimg.cn/large/006tNbRwgy1gamosnsknej30tg0viq6w.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu1c4km1j30tg0viq7v.jpg)

由于 i 和 j 之前没有大小关系,也就说二者可以相互替代。因此:

Expand All @@ -58,11 +58,11 @@ https://leetcode-cn.com/problems/maximum-of-absolute-value-expression/descriptio

为了方便,我们将 i 和 j 都提取到一起:

![](https://tva1.sinaimg.cn/large/006tNbRwly1gamp5sizefj30qs0g6gmx.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu1j6ueoj30qs0g6di2.jpg)

容易看出等式的最大值就是前面的最大值,和后面最小值的差值。如图:

![](https://tva1.sinaimg.cn/large/006tNbRwly1gamp9c3g9lj30r20kcabx.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu1oczs3j30r20kctb5.jpg)

再仔细观察,会发现前面部分和后面部分是一样的,原因还是上面所说的 i 和 j 可以互换。因此我们要做的就是:

Expand Down Expand Up @@ -97,17 +97,17 @@ class Solution:

### 思路

![](https://tva1.sinaimg.cn/large/006tNbRwly1gampnn032tj308l0a8mxl.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu23wcsoj308l0a8aak.jpg)

(图来自: https://zh.wikipedia.org/wiki/%E6%9B%BC%E5%93%88%E9%A0%93%E8%B7%9D%E9%9B%A2)

一维曼哈顿距离可以理解为一条线上两点之间的距离: |x1 - x2|,其值为 max(x1 - x2, x2 - x1)

![](https://tva1.sinaimg.cn/large/006tNbRwgy1gampr362oaj30l004mdfv.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu2729n3j30l004mwel.jpg)

在平面上,坐标(x1, y1)的点 P1 与坐标(x2, y2)的点 P2 的曼哈顿距离为:|x1-x2| + |y1 - y2|,其值为 max(x1 - x2 + y1 - y2, x2 - x1 + y1 - y2, x1 - x2 + y2 - y1, x2 -x1 + y2 - y1)

![](https://tva1.sinaimg.cn/large/006tNbRwgy1gampwhua9fj30rq0lmdgl.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu29xa0jj30rq0lmwga.jpg)

然后这道题目是更复杂的三维曼哈顿距离,其中(i, arr[i], arr[j])可以看作三位空间中的一个点,问题转化为曼哈顿距离最远的两个点的距离。
延续上面的思路,|x1-x2| + |y1 - y2| + |z1 - z2|,其值为 :
Expand Down Expand Up @@ -186,6 +186,6 @@ class Solution:

- [1030. 距离顺序排列矩阵单元格](https://leetcode-cn.com/problems/matrix-cells-in-distance-order/)

![](https://tva1.sinaimg.cn/large/006tNbRwly1gamq577lgsj30xd0jzwjb.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu2h4bnaj30xd0jzgom.jpg)

- [1162. 地图分析](https://leetcode-cn.com/problems/as-far-from-land-as-possible/)
4 changes: 2 additions & 2 deletions problems/1168.optimize-water-distribution-in-a-village-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pipes[i][0] != pipes[i][1]
## 思路


![example 1](../assets/problems/1168.optimize-water-distribution-in-a-village-example1.png)
![example 1](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu0bzlucj30ci0bc3z0.jpg)

题意,在每个城市打井需要一定的花费,也可以用其他城市的井水,城市之间建立连接管道需要一定的花费,怎么样安排可以花费最少的前灌溉所有城市。

Expand Down Expand Up @@ -65,7 +65,7 @@ pipes[i][0] != pipes[i][1]

如图:

![minimum cost](../assets/problems/1168.optimize-water-distribution-in-a-village-1.png)
![minimum cost](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu0jq6djj31400u0nfs.jpg)

从图中可以看到,最后所有的节点都是连通的。

Expand Down
4 changes: 2 additions & 2 deletions problems/1168.optimize-water-distribution-in-a-village-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pipes[i][0] != pipes[i][1]
```
example 1 pic:

![example 1](../assets/problems/1168.optimize-water-distribution-in-a-village-example1.png)
![example 1](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltymocpgj30ci0bc3z0.jpg)


## Solution
Expand All @@ -61,7 +61,7 @@ For example:`n = 5, wells=[1,2,2,3,2], pipes=[[1,2,1],[2,3,1],[4,5,7]]`

As below pic:

![minimum cost](../assets/problems/1168.optimize-water-distribution-in-a-village-1.png)
![minimum cost](https://tva1.sinaimg.cn/large/007S8ZIlly1ghltyopr5zj31400u0nfs.jpg)

From pictures, we can see that all nodes already connected with minimum costs.

Expand Down
2 changes: 1 addition & 1 deletion problems/121.best-time-to-buy-and-sell-stock.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Explanation: In this case, no transaction is done, i.e. max profit = 0.

用图表示的话就是这样:

![](https://tva1.sinaimg.cn/large/0082zybply1gbx7rzp9e1j30jg0c23zs.jpg)
![](https://tva1.sinaimg.cn/large/007S8ZIlly1ghlu6k05dqj30jg0c20tf.jpg)

## 关键点解析

Expand Down
Loading

0 comments on commit bb2a96f

Please sign in to comment.