|
@ -1,11 +1,15 @@ |
|
|
|
|
|
## Array Diff |
|
|
|
|
|
|
|
|
Your goal in this kata is to implement a difference function, which subtracts |
|
|
Your goal in this kata is to implement a difference function, which subtracts |
|
|
one list from another and returns the result. |
|
|
one list from another and returns the result. |
|
|
|
|
|
|
|
|
It should remove all values from list a, which are present in list b keeping |
|
|
It should remove all values from list a, which are present in list b keeping |
|
|
their order. |
|
|
their order. |
|
|
|
|
|
``` |
|
|
|
|
|
array_diff(vec![1,2], vec![1]) == vec![2] |
|
|
|
|
|
``` |
|
|
|
|
|
If a value is present in b, all of its occurrences must be removed from the other: |
|
|
|
|
|
|
|
|
array_diff(vec![1,2], vec![1]) == vec![2] If a value is present in b, all of its |
|
|
|
|
|
occurrences must be removed from the other: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
array_diff(vec![1,2,2,2,3], vec![2]) == vec![1,3] |
|
|
array_diff(vec![1,2,2,2,3], vec![2]) == vec![1,3] |
|
|
|
|
|
|
|
|
|
|
|
``` |