equal
deleted
inserted
replaced
3 |
3 |
4 def pow(A: Set[String], n: Int) : Set[String] = n match { |
4 def pow(A: Set[String], n: Int) : Set[String] = n match { |
5 case 0 => Set("") |
5 case 0 => Set("") |
6 case n => concat(A, pow(A, n- 1)) |
6 case n => concat(A, pow(A, n- 1)) |
7 } |
7 } |
|
8 |
|
9 val A = Set("1", "2", "3", "") |
|
10 val B = Set("1", "2", "3", "4", "5", "6", "") |
|
11 concat(A, B).size // -> 28 |
|
12 pow(B, 3).size |
|
13 |
8 |
14 |
9 val A = Set("a", "b", "c", "d") |
15 val A = Set("a", "b", "c", "d") |
10 pow(A, 4).size // -> 256 |
16 pow(A, 4).size // -> 256 |
11 |
17 |
12 val B = Set("a", "b", "c", "") |
18 val B = Set("a", "b", "c", "") |