-
B = 4個數值
- 3
- 5
- 7
- 8
-
A = 8個數值
- 1
- 2
- 3
- 4
- 5
- 6
- 2
- 3
-
A與B合併再排序 = 12個數值
- 1
- 2
- 2
- 3
- 3
- 3
- 4
- 5
- 5
- 6
- 7
- 8
-
去除重複筆數後得出A+B數列 = 8個數值
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
-
A與B重複數字 = 2個數值
- 3
- 5
-
A本身重複數字=2個數值
- 2
- 3
-
不考慮數列本身重複的數值
- Remove duplication ( Sort ( 8 + 4 ) ) = 8
- Repeat ( A & B ) = 12 - 8 = 4
-
考慮數列本身重複的數值
- Remove A duplication ( Sort ( A ) ) = 6
- Remove duplication ( Sort ( 6 + 4 ) ) = 8
- Repeat ( A & B ) = 10 - 8 = 2