Check of Subset of Array is Equals or Not.
Hi everyone, Have a great day. Again after long days, I post some interview question. Check below. If you've some best solution this, then you can comment on the post.
Question:
Write a function that takes two arrays as input, each array contains a list of A-Z; Your program should return True if the 2nd
array is a subset of 1st array, or False if not.
For example:
isSubset([A,B,C,D,E], [A,E,D]) = true
isSubset([A,B,C,D,E], [A,D,Z]) = false
isSubset([A,D,E], [A,A,D,E]) = true
Answer:
See my Github Gist.
Question:
Write a function that takes two arrays as input, each array contains a list of A-Z; Your program should return True if the 2nd
array is a subset of 1st array, or False if not.
For example:
isSubset([A,B,C,D,E], [A,E,D]) = true
isSubset([A,B,C,D,E], [A,D,Z]) = false
isSubset([A,D,E], [A,A,D,E]) = true
Answer:
See my Github Gist.
Comments