Interview Solution

hiring people to write code to sell is not the same as hiring people to design and build durable, usable, dependable software. Larry Constantine

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.