Beta
Operations on Sets: Symmetric Difference
40Saka7
Description:
In mathematics, a set is a collection of distinct numbers. The symmetric difference of two sets is the set of elements which are in either of the sets and not in their intersection.
Symmetric Difference of a and b (a△b) marked in gray
Your taks is to implement method getSymmetricDifference
which takes two sets of unique integer values and returns symmetric difference of these sets.
Examples:
a = {2, 3, 7, 8}
b = {5, 6, 2, 4, 7}
a△b = {3, 8, 5, 6, 4}
a = {3, 4, 2, 5, 7, 9}
b = {1, 9, 8}
a△b = {3, 4, 2, 5, 7, 1, 8}
a = {13, 255, 354, 211, 120}
b = {255, 354, 211, 120, 13}
a△b = {}
// If any of sets are empty method should return another set
a = {}
b = {5, 6, 2, 4, 7}
a△b = {5, 6, 2, 4, 7}
// If both sets are empty method should return empty set
a = {}
b = {}
a△b = {}
Note: Method should return null if any of the arguments is null
Algorithms
Mathematics
Sets
Similar Kata:
Stats:
Created | Apr 22, 2016 |
Published | Apr 22, 2016 |
Warriors Trained | 96 |
Total Skips | 13 |
Total Code Submissions | 225 |
Total Times Completed | 40 |
Java Completions | 40 |
Total Stars | 2 |
% of votes with a positive feedback rating | 95% of 19 |
Total "Very Satisfied" Votes | 17 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 22 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |