Problem Statement
Christmas is just around the corner, and Alice just decorated her Christmas tree. There are N stars and N-1 ribbons on the tree. Each ribbon connects two of the stars in such a way that all stars and ribbons hold together. (In other words, the stars and ribbons are the vertices and edges of a tree.)
The stars are numbered 1 through N.
Additionally, each star has some color.
You are given the colors of stars as a
You are also given a description of the ribbons: two
According to Alice, a ribbon that connects two stars with different colors is beautiful, while a ribbon that connects two same-colored stars is not. Compute and return the number of beautiful ribbons in Alice's tree.
Definition
- Class:
- ChristmasTreeDecorationDiv2
- Method:
- solve
- Parameters:
- int[], int[], int[]
- Returns:
- int
- Method signature:
- int solve(int[] col, int[] x, int[] y)
- (be sure your method is public)
Constraints
- N will be between 2 and 50, inclusive.
- The number of elements in col will be exactly N.
- The number of elements in x will be exactly N - 1.
- The number of elements in y will be the same as the number of elements in x.
- All elements of x and y will be between 1 and N, inclusive.
- For each i, the numbers x[i] and y[i] will be different.
- The graph formed by the N-1 ribbons will be connected.
Examples
{1,2,3,3}
{1,2,3}
{2,3,4}
Returns: 2
There are two beautiful ribbons: the one that connects stars 1 and 2, and the one that connects stars 2 and 3. The other ribbon is not beautiful because stars 3 and 4 have the same color.
{1,3,5}
{1,3}
{2,2}
Returns: 2
{1,1,3,3}
{1,3,2}
{2,1,4}
Returns: 2
{5,5,5,5}
{1,2,3}
{2,3,4}
Returns: 0
{9,1,1}
{3,2}
{2,1}
Returns: 1
{13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}
{21,2,30,28,18,4,23,38,37,5,38,37,26,20,26,16,15,16,16,35,37,40,12,34,31,10,33,31,14,17,9,33,4,13,15,2,22,12,36}
{1,10,9,29,35,14,1,39,7,4,11,38,10,15,8,7,26,17,14,25,28,23,19,26,3,14,24,18,1,6,15,15,32,3,27,31,8,13,8}
Returns: 0
{47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47}
{40,31,35,16,37,27,19,34,27,30,6,32,29,15,24,34,31,25,26,20,4,31,18,36,8,3,3,7,17,1,9,13,10,9,28,15,2,3,11}
{17,27,17,8,7,32,28,20,21,39,32,22,25,30,32,35,38,34,16,12,25,1,4,26,12,23,29,19,22,14,35,3,32,33,5,26,4,5,14}
Returns: 0
{32,32,32,14,14,32,14,32,32,14,32,32,14,32,14,14,32,32,14,14,14,14,32,14,32,14,14,14,32,14,14,32,14,14,32,32,32,32,32,14}
{26,39,15,30,25,17,38,39,15,9,9,1,17,28,22,6,5,15,4,33,2,33,35,5,11,3,40,32,8,18,37,14,37,31,19,39,29,13,14}
{11,1,25,10,2,21,6,20,36,16,39,30,36,24,5,16,13,7,20,9,38,27,38,34,27,25,38,21,12,33,34,17,10,5,30,8,7,24,23}
Returns: 16
{20,44,20,20,44,44,44,44,44,44,20,20,20,20,44,44,44,20,20,44,20,20,20,20,44,44,20,44,44,44,20,20,20,44,20,44,20,44,44,44}
{5,8,14,25,30,29,31,5,29,20,24,21,21,2,22,22,35,5,4,31,20,10,26,6,3,18,23,6,9,23,36,3,11,31,2,20,17,1,37}
{29,29,19,36,19,15,18,1,34,24,14,12,30,4,21,3,10,40,17,4,28,22,19,29,8,28,36,39,17,27,8,16,14,32,38,7,13,33,2}
Returns: 15
{30,23,18,30,18,18,23,30,23,30,23,18,18,30,23,18,23,30,30,18,30,30,23,23,18,18,30,30,18,18,23,18,18,18,18,18,18,23,18,30}
{19,39,8,32,39,26,38,21,1,36,14,33,29,7,25,27,33,5,11,12,17,21,7,1,30,28,23,28,27,3,16,7,16,23,2,12,34,37,12}
{4,36,12,15,13,5,6,15,20,18,7,31,3,13,38,20,7,20,26,6,36,10,23,35,39,30,40,24,2,1,22,4,5,10,15,10,4,34,9}
Returns: 26
{42,36,36,42,36,36,10,10,42,36,10,10,42,42,42,42,36,10,10,42,10,10,10,10,42,36,42,42,36,10,36,42,10,36,36,10,36,36,10,10}
{36,12,33,26,10,30,20,29,10,37,33,11,28,26,29,34,16,4,37,23,18,4,13,31,29,34,32,4,15,13,7,24,22,19,19,33,26,39,35}
{16,34,31,20,2,38,24,16,40,32,3,10,2,16,5,25,28,8,28,9,1,32,25,10,18,17,23,6,16,4,26,30,38,39,25,35,27,21,14}
Returns: 27
{29,29,18,29,3,34,3,34,29,34,29,3,18,18,3,29,34,18,18,34,3,3,34,18,3,3,34,34,18,18,29,3,29,29,3,18,3,29,34,34}
{7,15,6,18,20,38,39,8,13,8,30,9,30,35,9,36,25,29,13,9,5,34,39,1,4,34,13,21,17,40,19,1,40,8,23,4,29,40,17}
{30,22,23,16,1,28,20,12,33,38,24,39,33,10,18,39,9,26,19,5,32,6,10,24,38,33,22,19,27,12,37,2,14,18,3,27,7,11,31}
Returns: 28
{21,21,37,14,37,8,8,37,14,8,8,21,21,8,21,21,8,14,21,14,14,21,8,21,21,8,21,21,8,37,37,14,21,8,8,37,21,37,21,14}
{15,37,5,8,6,24,21,30,40,23,30,16,39,23,30,31,26,2,30,18,40,26,11,8,22,21,8,17,10,3,9,9,6,14,13,36,25,35,20}
{23,23,19,26,27,38,12,31,6,7,2,24,31,24,27,4,37,1,21,29,34,39,1,32,5,33,19,31,14,8,4,28,25,12,8,35,35,18,11}
Returns: 32
{36,40,11,21,40,40,21,40,11,21,26,11,11,11,40,11,36,11,36,11,36,26,40,21,36,26,11,36,21,21,11,11,26,11,11,21,36,26,36,26}
{23,37,4,26,12,27,23,16,26,14,3,10,39,34,4,4,28,28,40,38,12,31,25,21,8,40,31,31,29,15,17,35,14,36,8,20,37,27,21}
{20,39,22,6,13,5,29,36,25,27,25,15,7,30,32,16,27,11,38,6,2,36,11,13,1,7,29,34,38,21,20,31,18,13,24,9,19,24,33}
Returns: 30
{48,48,24,40,16,24,33,40,33,16,24,16,24,40,16,40,48,48,33,40,48,24,24,48,48,24,48,33,16,24,48,40,16,16,24,24,40,16,16,24}
{32,2,23,7,4,13,11,38,18,39,17,40,19,31,34,9,37,1,36,1,28,7,7,19,29,11,25,29,1,21,10,20,16,18,18,32,11,22,22}
{14,8,27,14,27,38,12,28,9,10,28,23,24,9,8,4,33,36,16,11,3,30,38,23,26,9,37,9,6,34,26,16,38,15,2,5,25,35,8}
Returns: 33
{48,34,16,16,29,48,16,48,6,34,34,48,6,6,34,34,29,29,6,29,12,12,29,6,12,29,29,29,12,48,6,12,12,34,12,12,12,34,29,34}
{16,34,11,28,33,13,10,34,35,2,38,32,22,31,18,38,1,23,17,38,28,35,12,21,21,33,39,9,30,37,15,36,25,25,21,14,25,4,5}
{9,11,2,24,29,3,33,22,22,17,2,6,3,34,2,19,10,35,8,26,33,6,24,13,16,3,15,20,26,10,30,27,18,40,7,3,36,5,7}
Returns: 33
{35,19,33,16,35,16,35,33,16,35,35,35,13,33,35,13,33,19,19,19,35,33,16,42,42,42,42,16,13,42,16,35,19,42,19,19,16,33,42,13}
{1,30,9,21,18,15,23,14,15,26,18,24,18,32,14,14,7,20,27,40,28,28,16,34,31,18,25,34,26,38,33,29,40,36,10,35,13,15,8}
{12,14,27,2,26,40,39,38,13,9,17,12,37,25,15,3,40,9,29,31,34,33,4,25,11,24,40,9,5,19,4,6,21,20,9,22,22,39,13}
Returns: 34
{14,27,14,40,37,40,6,37,37,29,29,40,27,14,37,33,27,6,33,14,40,27,14,14,37,6,29,29,6,6,33,33,27,33,37,27,37,27,33,14}
{11,7,37,33,34,30,12,11,33,17,19,3,8,2,6,7,28,2,23,25,13,5,2,34,39,5,4,37,18,15,27,26,28,3,16,17,29,23,36}
{10,5,4,11,20,22,10,15,22,18,6,11,38,24,33,1,39,3,40,9,11,19,34,25,27,29,38,12,25,14,20,1,40,16,32,35,21,31,6}
Returns: 34
{24,35,47,26,50,35,24,35,26,26,47,34,9,24,35,47,47,47,26,34,47,24,47,35,35,50,26,50,50,47,35,9,35,34,26,50,24,26,47,47}
{37,37,23,20,4,33,15,13,8,26,33,9,39,26,37,35,39,3,16,3,29,24,35,29,39,4,2,11,40,21,35,40,14,27,25,6,26,38,5}
{36,12,18,10,28,12,31,9,7,37,15,3,22,27,32,31,34,23,31,33,8,7,20,33,16,24,24,19,20,36,6,19,1,14,38,25,17,30,34}
Returns: 31
{2,18,29,19,16,41,28,29,2,28,18,29,19,16,16,16,16,41,33,16,29,29,19,2,18,18,29,16,33,29,29,33,41,2,29,29,19,16,19,29}
{30,31,24,15,19,14,17,7,3,36,4,16,7,15,15,1,31,21,25,5,32,36,12,31,6,3,34,40,19,21,40,23,30,16,37,39,29,8,23}
{34,35,14,27,14,17,2,17,22,11,12,38,33,21,24,37,11,10,12,38,7,10,17,28,11,34,11,18,20,9,17,30,13,35,16,37,1,12,26}
Returns: 32
{3,31,9,30,31,9,31,33,9,3,33,41,3,28,35,3,31,30,31,31,31,9,3,9,30,28,28,28,35,35,41,35,41,3,30,31,28,9,33,33}
{12,4,34,23,30,12,5,3,17,10,7,6,8,30,34,15,23,13,20,25,18,40,36,36,39,7,20,6,20,14,13,2,21,32,16,27,35,2,22}
{24,39,31,8,25,15,31,21,11,36,25,30,31,37,15,26,28,24,31,40,9,11,3,18,5,1,19,33,30,28,21,29,38,23,1,25,32,23,19}
Returns: 35
{17,42,17,42,17,47,47,1,1,2,48,1,4,2,48,2,42,30,2,17,2,17,11,1,1,42,42,11,42,4,30,30,11,11,2,17,11,48,47,42}
{24,16,28,33,2,3,30,19,13,32,19,20,38,14,21,13,33,5,25,21,37,24,18,3,7,12,40,7,17,33,17,10,25,18,4,9,23,5,34}
{3,22,35,20,15,38,38,28,6,27,12,14,15,30,31,21,22,20,13,15,39,1,37,8,3,18,36,18,6,27,29,24,26,36,25,16,3,11,13}
Returns: 36
{14,47,2,47,15,47,1,22,25,1,12,1,29,47,14,29,1,14,2,2,22,14,15,12,1,12,1,29,25,29,2,14,12,22,47,15,47,25,22,15}
{6,26,13,35,31,31,1,28,15,8,18,7,29,30,31,34,33,14,1,10,28,25,17,8,29,20,35,38,19,32,19,2,10,25,34,10,22,5,3}
{11,27,39,7,15,8,16,10,25,21,26,20,32,8,19,31,37,38,29,39,17,33,2,23,6,40,13,12,16,17,36,5,24,9,38,26,15,4,11}
Returns: 36
{28,2,9,22,47,47,28,17,2,50,2,47,29,22,2,9,29,22,50,29,47,29,2,8,2,50,47,50,2,2,22,8,22,2,22,22,9,9,2,45}
{1,38,22,27,32,13,9,22,17,27,4,18,24,3,16,28,10,16,34,12,40,10,33,36,8,29,23,34,13,4,38,24,35,26,26,20,1,39,20}
{32,5,21,4,24,34,23,12,12,35,32,10,8,28,2,14,13,4,23,9,17,31,8,13,25,25,16,15,28,37,15,6,11,11,7,26,19,20,30}
Returns: 34
{7,7,47,23,47,32,4,7,32,35,32,23,23,4,35,18,7,23,18,7,5,7,32,34,34,47,18,18,47,25,32,23,7,18,4,18,4,25,4,5}
{8,23,4,20,2,10,30,32,16,11,13,4,25,15,34,22,37,26,25,17,5,31,40,14,19,21,25,33,8,3,18,35,7,10,25,28,39,12,9}
{22,29,16,17,8,15,11,8,38,29,25,5,6,18,40,7,1,14,23,8,17,26,26,22,8,25,19,15,37,26,24,18,36,17,27,32,36,33,33}
Returns: 33
{13,12,32,10,47,10,6,11,11,6,12,48,47,35,10,37,10,35,35,48,12,48,14,11,10,47,13,12,35,48,11,32,47,14,48,12,48,37,32,11}
{2,18,29,3,17,39,40,17,34,10,21,22,20,23,13,10,6,35,7,31,1,35,26,34,15,8,31,1,24,21,40,7,38,36,17,16,30,37,27}
{1,28,13,16,19,12,39,21,5,38,15,2,28,6,12,28,34,20,26,29,21,12,15,15,40,29,32,30,22,14,4,25,9,12,11,8,33,12,14}
Returns: 36
{37,9,27,21,2,21,27,48,48,37,30,28,48,2,24,9,9,30,24,48,13,24,30,9,28,13,2,13,30,24,20,37,30,48,20,13,48,21,21,2}
{3,14,24,5,24,6,37,8,16,22,17,2,29,12,19,14,15,19,21,13,40,7,22,10,8,10,28,31,1,23,15,13,23,30,35,20,33,30,34}
{17,8,3,9,32,12,6,11,4,27,26,38,15,35,38,12,24,11,30,10,24,12,28,36,24,24,25,16,40,6,9,4,25,39,18,12,30,34,12}
Returns: 39
{36,4,36,36,34,36,20,31,37,13,30,17,13,13,49,34,36,4,8,37,30,13,8,8,34,20,31,31,37,34,4,13,17,17,34,17,34,4,20,4}
{12,21,28,10,25,34,3,2,12,21,10,5,5,22,27,11,33,20,12,30,40,13,14,24,22,10,36,37,4,21,21,7,30,30,39,23,20,38,8}
{29,33,16,31,7,19,26,1,15,12,29,16,15,21,25,17,18,30,14,9,18,37,6,11,17,9,1,14,17,25,36,34,3,32,10,18,35,18,18}
Returns: 35
{45,44,19,45,40,44,45,30,25,28,25,4,44,30,30,40,19,4,45,45,14,29,28,19,4,4,45,14,46,40,28,14,19,45,30,21,21,45,14,25}
{15,30,7,31,36,10,24,17,3,29,37,36,33,23,3,15,40,24,7,6,21,3,4,25,25,22,2,1,17,13,9,12,17,31,14,23,35,11,39}
{23,14,17,40,30,14,2,40,20,11,30,3,20,31,31,32,4,17,8,37,15,26,22,38,26,12,16,4,19,15,24,27,5,39,34,18,15,23,28}
Returns: 33
{32,8,27,50,9,6,9,50,35,35,50,37,24,12,50,16,9,27,2,35,24,2,24,9,8,29,16,35,29,16,27,16,37,37,32,8,24,29,12,16}
{40,11,4,29,20,7,15,22,24,23,21,5,25,1,15,28,21,9,3,40,3,37,19,31,15,35,17,1,10,20,25,27,2,17,7,23,2,16,34}
{37,34,26,31,17,29,6,32,13,26,34,6,12,33,30,34,1,7,19,18,38,5,17,11,7,14,12,24,38,33,36,21,20,35,22,38,39,18,8}
Returns: 38
{23,28,41,28,28,25,46,47,23,16,47,36,9,5,25,5,9,36,28,16,15,23,28,16,36,41,48,23,33,46,28,5,36,33,16,46,28,25,47,28}
{31,33,15,31,28,9,6,2,33,38,12,38,22,18,18,40,17,4,8,31,13,33,40,11,32,18,38,32,36,40,12,26,19,8,40,2,3,9,5}
{35,10,16,1,32,20,16,32,30,31,10,32,16,21,10,20,19,25,7,15,1,36,34,4,26,24,25,36,14,1,27,23,29,35,17,37,26,39,1}
Returns: 37
{18,23,35,43,25,35,43,25,25,43,18,31,45,45,1,37,31,31,46,35,35,31,8,18,23,43,18,25,37,35,31,8,45,46,1,23,31,41,31,35}
{30,38,8,39,39,21,35,34,37,29,1,36,6,14,23,12,4,40,27,20,7,3,10,23,33,25,2,5,13,25,15,38,13,4,2,5,26,38,1}
{16,15,22,25,30,1,2,23,38,39,14,6,17,17,21,23,38,30,13,1,5,28,26,18,23,12,38,23,32,27,22,1,19,31,28,11,23,9,24}
Returns: 36
{13,10,17,37,17,43,27,27,10,37,17,40,50,13,28,20,40,48,40,50,47,13,27,17,47,10,28,38,20,40,43,48,17,13,38,48,40,40,40,10}
{33,33,35,23,3,16,35,36,17,40,8,12,1,12,36,27,31,13,31,31,22,38,14,20,14,40,21,21,30,5,31,31,17,2,37,21,29,26,19}
{15,17,23,11,32,21,13,15,29,5,11,4,20,29,1,36,13,34,29,24,36,27,9,6,37,3,7,40,37,34,39,30,10,4,25,18,28,24,21}
Returns: 38
{26,29,34,37,12,23,32,42,14,23,29,29,10,14,3,12,29,29,3,42,26,14,14,14,10,26,24,29,32,24,42,42,23,5,10,14,12,5,24,3}
{15,26,34,19,17,33,29,25,6,16,11,19,8,28,12,39,36,3,38,16,6,29,9,3,9,17,32,25,10,5,25,6,6,18,20,40,19,21,23}
{4,17,32,7,36,35,27,2,28,1,19,35,1,29,23,16,39,23,4,7,14,31,38,19,24,38,8,20,17,30,5,13,30,35,37,19,20,27,22}
Returns: 35
{50,43,20,15,14,50,15,29,29,43,41,40,15,15,33,20,20,9,48,50,24,42,50,42,9,9,33,50,14,15,15,41,41,33,29,40,48,21,20,42}
{39,39,22,37,22,6,3,20,33,7,8,30,7,39,3,37,21,1,31,12,35,39,40,38,24,27,25,17,24,15,26,24,23,17,4,24,19,35,11}
{24,31,40,21,35,2,16,27,9,1,22,21,13,19,10,34,1,18,3,37,29,35,13,22,4,21,18,33,14,17,22,32,1,5,17,36,2,28,22}
Returns: 34
{12,2,25,5,12,46,12,22,12,43,18,18,5,4,18,50,46,11,46,11,2,4,47,43,2,46,27,47,12,50,50,5,27,47,25,5,24,12,22,49}
{25,35,36,30,34,19,34,26,28,34,31,18,13,36,27,20,6,23,7,4,10,33,5,3,36,5,7,6,37,33,39,20,14,35,16,15,39,38,21}
{23,17,12,32,40,4,35,34,18,32,19,31,28,24,36,25,17,7,10,20,26,20,9,13,9,10,29,38,10,8,11,11,2,21,33,30,22,14,1}
Returns: 36
{47,22,21,40,39,21,17,6,6,2,12,2,28,16,47,21,22,24,38,47,25,12,47,22,40,25,25,24,21,38,24,25,25,24,24,2,31,17,24,17}
{6,26,30,30,1,16,27,13,26,38,11,5,13,7,14,8,7,31,25,5,9,27,25,5,27,23,1,34,17,32,33,39,35,9,12,32,4,20,19}
{18,22,31,11,33,14,1,40,11,39,40,7,9,2,12,17,30,14,18,24,15,28,22,10,4,32,37,7,38,34,14,29,15,3,38,21,20,36,13}
Returns: 38
{7,25,20,32,49,16,16,38,16,45,20,3,8,8,16,8,8,38,32,2,20,18,33,38,8,8,48,18,20,2,33,48,1,45,20,22,3,7,13,2}
{26,4,33,17,29,11,22,29,31,35,32,38,18,19,15,35,12,3,19,28,14,1,15,34,23,40,27,31,31,40,2,18,27,15,28,10,9,9,21}
{24,39,35,31,35,15,4,17,26,13,22,33,16,37,36,34,24,17,20,30,23,5,13,39,16,12,40,7,25,6,31,29,20,5,38,28,3,21,8}
Returns: 38
{34,46,42,24,42,47,38,43,42,43,24,24,38,46,46,9,25,14,28,46,43,9,11,43,34,49,42,47,49,21,46,24,25,21,38,25,21,9,42,47}
{15,27,21,3,37,3,2,12,16,28,20,36,25,18,10,4,17,9,27,25,7,39,31,5,21,12,4,11,7,32,10,20,26,6,33,24,6,19,30}
{24,2,11,14,28,39,22,25,10,19,5,5,29,29,1,26,5,20,21,17,2,24,12,34,8,14,24,25,35,24,35,19,13,20,13,40,38,23,11}
Returns: 36
{2,3,42,1,42,37,34,3,37,37,42,18,18,45,26,5,18,6,42,1,2,39,49,45,18,6,26,2,34,39,5,45,49,5,37,17,18,42,45,49}
{22,5,18,37,8,31,6,16,40,19,1,12,40,3,32,28,35,37,7,40,13,30,6,8,18,14,11,5,33,24,24,10,28,27,2,21,14,34,14}
{32,9,26,14,35,19,31,25,25,15,8,33,29,40,25,26,37,9,33,20,22,13,9,30,22,4,18,39,6,3,36,25,17,29,39,30,23,1,38}
Returns: 37
{28,7,43,7,48,19,28,31,38,4,43,19,43,1,9,27,38,42,1,8,11,5,11,38,5,9,7,11,20,38,42,27,5,48,7,28,26,38,5,43}
{17,35,21,14,36,39,13,10,3,37,36,39,18,10,6,23,4,25,37,35,29,11,29,12,11,9,17,11,10,4,10,22,2,28,23,35,6,30,28}
{38,8,17,4,40,18,32,16,30,21,11,1,12,37,15,31,13,22,14,38,21,26,18,24,33,5,31,34,20,36,27,17,5,35,5,7,16,27,19}
Returns: 37
{12,8,35,27,45,25,1,3,8,48,10,35,35,18,1,1,16,16,3,41,28,45,28,8,7,45,18,12,18,12,16,12,40,12,16,41,22,12,7,41}
{40,10,28,32,20,18,22,8,23,26,13,3,34,27,30,32,20,36,2,17,18,7,15,38,39,12,19,1,38,5,39,2,2,38,16,25,23,35,39}
{11,18,15,34,16,16,36,7,15,2,30,23,35,8,26,15,35,26,16,32,14,28,11,39,4,6,35,12,7,36,37,31,6,9,21,32,29,24,33}
Returns: 38
{31,50,14,10,46,42,5,19,14,36,26,5,18,31,23,35,37,44,18,10,10,31,10,49,19,36,42,23,35,36,46,19,29,26,10,44,48,5,4,26}
{26,13,19,29,39,38,14,32,31,17,33,2,2,5,11,3,6,29,31,1,23,8,3,25,29,4,40,14,9,19,22,32,36,14,17,11,11,15,25}
{37,29,25,21,38,21,26,30,7,6,2,22,36,30,25,17,8,16,39,20,1,27,13,32,40,17,28,35,40,28,20,18,28,2,34,10,24,8,12}
Returns: 37
{1, 1, 3, 3 }
{1, 3, 2 }
{2, 1, 4 }
Returns: 2
{1, 2, 3, 3 }
{1, 2, 3 }
{2, 3, 4 }
Returns: 2
{1, 2, 3, 1 }
{1, 2, 3 }
{4, 3, 1 }
Returns: 2
{5, 5, 5, 5 }
{1, 2, 3 }
{2, 3, 4 }
Returns: 0
{1, 2 }
{1 }
{2 }
Returns: 1
{1, 1, 1, 1 }
{1, 2, 3 }
{2, 3, 4 }
Returns: 0
{5, 5, 5, 5, 6 }
{1, 2, 3, 4 }
{2, 3, 4, 5 }
Returns: 1
{1, 1 }
{1 }
{2 }
Returns: 0
{5, 5, 5, 5 }
{1, 2, 3 }
{4, 4, 4 }
Returns: 0
{1, 3, 3 }
{1, 2 }
{3, 3 }
Returns: 1
{1, 3, 1 }
{1, 3 }
{2, 1 }
Returns: 1