|
14 | 14 |
|
15 | 15 | <p> </p>
|
16 | 16 | <p><strong class="example">Example 1:</strong></p>
|
17 |
| -<img alt="" src="./images/example1.jpg" style="width: 1024px; height: 453px;"> |
18 |
| -<pre><strong>Input:</strong> n = 5, edges = [[0,2],[1,2],[1,3],[2,4]], values = [1,8,1,4,4], k = 6 |
| 17 | +<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2800-2899/2872.Maximum%20Number%20of%20K-Divisible%20Components/images/example12-cropped2svg.jpg" style="width: 1024px; height: 453px;" /> |
| 18 | +<pre> |
| 19 | +<strong>Input:</strong> n = 5, edges = [[0,2],[1,2],[1,3],[2,4]], values = [1,8,1,4,4], k = 6 |
19 | 20 | <strong>Output:</strong> 2
|
20 | 21 | <strong>Explanation:</strong> We remove the edge connecting node 1 with 2. The resulting split is valid because:
|
21 | 22 | - The value of the component containing nodes 1 and 3 is values[1] + values[3] = 12.
|
22 | 23 | - The value of the component containing nodes 0, 2, and 4 is values[0] + values[2] + values[4] = 6.
|
23 | 24 | It can be shown that no other valid split has more than 2 connected components.</pre>
|
24 | 25 |
|
25 | 26 | <p><strong class="example">Example 2:</strong></p>
|
26 |
| -<img alt="" src="./images/example2.jpg" style="width: 999px; height: 338px;"> |
27 |
| -<pre><strong>Input:</strong> n = 7, edges = [[0,1],[0,2],[1,3],[1,4],[2,5],[2,6]], values = [3,0,6,1,5,2,1], k = 3 |
| 27 | +<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2800-2899/2872.Maximum%20Number%20of%20K-Divisible%20Components/images/example21svg-1.jpg" style="width: 999px; height: 338px;" /> |
| 28 | +<pre> |
| 29 | +<strong>Input:</strong> n = 7, edges = [[0,1],[0,2],[1,3],[1,4],[2,5],[2,6]], values = [3,0,6,1,5,2,1], k = 3 |
28 | 30 | <strong>Output:</strong> 3
|
29 | 31 | <strong>Explanation:</strong> We remove the edge connecting node 0 with 2, and the edge connecting node 0 with 1. The resulting split is valid because:
|
30 | 32 | - The value of the component containing node 0 is values[0] = 3.
|
|
0 commit comments