Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
110 lines (104 sloc) 5.61 KB
 Basic set notation
randRangeUnique(1, 15, randRange(2, 5)) randRangeUnique(1, 15, randRange(2, 5)) sortNumbers(_.union(A, B)) sortNumbers(_.difference(A, B)) sortNumbers(_.intersection(A, B))

Let X and Y be sets:

X = \{A\}
Y = \{B\}

Enter the answer as a set, with members separated by commas.

\{ \}

\$('#solutionarea input').val()
var guessTrim = guess.replace(/\s/g, ""); var guessArray = guessTrim.length ? _.map(guessTrim.split(","), function(n) { return parseInt(n); }) : []; return _.isEqual(sortNumbers(guessArray), ANSWER);
\$('#solutionarea input').val(guess)
\$("#solutionarea input").eq(0).val() === "" ^ !\$("#solutionarea input").eq(1).is(":checked")
return guess ? true : "";

What is the set X \cup Y?

Remember that \cup refers to the union of sets.

The union of two sets X and Y is the collection of elements which are in X or in Y or in both X and Y.

The members of a set must be unique, and the order doesn't matter.

What is the set X \setminus Y?

Remember that \backslash refers to the difference between sets.

The difference of two sets X and Y is the collection of elements which are in X but not in Y.

The members of a set must be unique, and the order doesn't matter.