Skip to content

Commit 4282515

Browse files
authored
Update readme.md
1 parent 248eb7f commit 4282515

File tree

1 file changed

+18
-2
lines changed
  • src/main/java/g2301_2400/s2322_minimum_score_after_removals_on_a_tree

1 file changed

+18
-2
lines changed

src/main/java/g2301_2400/s2322_minimum_score_after_removals_on_a_tree/readme.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ Return _the **minimum** score of any possible pair of edge removals on the given
2323

2424
**Output:** 9
2525

26-
**Explanation:** The diagram above shows a way to make a pair of removals. - The 1<sup>st</sup> component has nodes [1,3,4] with values [5,4,11]. Its XOR value is 5 ^ 4 ^ 11 = 10. - The 2<sup>nd</sup> component has node [0] with value [1]. Its XOR value is 1 = 1. - The 3<sup>rd</sup> component has node [2] with value [5]. Its XOR value is 5 = 5. The score is the difference between the largest and smallest XOR value which is 10 - 1 = 9. It can be shown that no other pair of removals will obtain a smaller score than 9.
26+
**Explanation:** The diagram above shows a way to make a pair of removals.
27+
28+
- The 1<sup>st</sup> component has nodes [1,3,4] with values [5,4,11]. Its XOR value is 5 ^ 4 ^ 11 = 10.
29+
30+
- The 2<sup>nd</sup> component has node [0] with value [1]. Its XOR value is 1 = 1.
31+
32+
- The 3<sup>rd</sup> component has node [2] with value [5]. Its XOR value is 5 = 5.
33+
34+
The score is the difference between the largest and smallest XOR value which is 10 - 1 = 9. It can be shown that no other pair of removals will obtain a smaller score than 9.
2735

2836
**Example 2:**
2937

@@ -33,7 +41,15 @@ Return _the **minimum** score of any possible pair of edge removals on the given
3341

3442
**Output:** 0
3543

36-
**Explanation:** The diagram above shows a way to make a pair of removals. - The 1<sup>st</sup> component has nodes [3,4] with values [4,4]. Its XOR value is 4 ^ 4 = 0. - The 2<sup>nd</sup> component has nodes [1,0] with values [5,5]. Its XOR value is 5 ^ 5 = 0. - The 3<sup>rd</sup> component has nodes [2,5] with values [2,2]. Its XOR value is 2 ^ 2 = 0. The score is the difference between the largest and smallest XOR value which is 0 - 0 = 0. We cannot obtain a smaller score than 0.
44+
**Explanation:** The diagram above shows a way to make a pair of removals.
45+
46+
- The 1<sup>st</sup> component has nodes [3,4] with values [4,4]. Its XOR value is 4 ^ 4 = 0.
47+
48+
- The 2<sup>nd</sup> component has nodes [1,0] with values [5,5]. Its XOR value is 5 ^ 5 = 0.
49+
50+
- The 3<sup>rd</sup> component has nodes [2,5] with values [2,2]. Its XOR value is 2 ^ 2 = 0.
51+
52+
The score is the difference between the largest and smallest XOR value which is 0 - 0 = 0. We cannot obtain a smaller score than 0.
3753

3854
**Constraints:**
3955

0 commit comments

Comments
 (0)