Interview Solution

Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves. Alan Kay

subsets With Duplicate

Language Java | Level Intermediate | Category Interview Problems | July 24, 2015 4:52 pm

Comments


Interview Problem

Detect duplicate in a subset from a set of elements.
If we give the number of elements as 2, we will get 2^2= 2 * 2 = 4 output subsets.
If we give the number of elements as 3, we will get 2^3= 2 * 2 * 2 = 8 output subsets.
Example:-
Input array :[1, 2]
Output subsets:[[2], [1, 2], [1], []].


Output

   					 
Input array   :[1, 2, 3]
Output subsets:[[3], [2, 3], [2], [1, 3], [1, 2, 3], [1, 2], [1], []]

				    

Comments

Posted by gita.magani
April 14, 2016 12:00 pm

Looks like the Source code is incorrect for this problem.



Please login to add comments.