Interview Solution

The first 90 percent of the code accounts for the first 90 percent of the development time...The remaining 10 percent of the code accounts for the other 90 percent of the development time. Tom Cargill

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.