Interview Solution

As soon as we started programming, we found to our surprise that it wasn’t as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. Maurice Wilkes

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.