Hi All

 

I have a super list and it has 10 elements for example

 

superList = {1,2,3,4,5,6,7,8,9,0}

 

I have a sub list which has 3 elements

 

subList = {1,2,3}

 

I want to know if the superList only has elements in sublist and not any additional elements. Say in this case the superList has {4,5,6,7,8,9,0} it should throw false

 

also the superList need not have all the values of the sublist

Example 1:

superList = {1}

subList = {1,2,3}

Result = true

 

Example 2:

superList = {1,2}

subList = {1,2,3}

Result = true

 

Example 3:

superList = {1,2,3}

subList = {1,2,3}

Result = true

 

Example 4:

superList = {1,2,3,1}

subList = {1,2,3}

Result = true

 

Example 3:

superList = {1,2,3,4}

subList = {1,2,3}

Result = false

 

How should i go about this, any comments would be of great help!

 

Thanks

Kirti

FacebookTwitterLinkedin
Pin It
Joomla Tutorials for Beginners