I have a fixed elements array as : ['a', 'b', 'c', 'd']
This will be used as a base while comparing the input arrays (that can be subset of the master array)
I get an input array of various combinations that may satisfy below set of scenarios:
['a', 'c']
should return true
— can be sub set of master set
['a', 'b', 'd', 'c']
should return true
— no order restrictions and can be same as master set
['a', 'b', 'c', 'd', 'e']
should return false
— can’t contain additional element
['e', 'f']
should return false
— no matching elements found
and finally:
['a']
should return true
— can be sub set and can contain single element too, however that single element should be always 'a'
['b','c','d']
should return false
— all input arrays must contain at least the element 'a'