Challenge : Find the Power set of the given set without using loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Challenge : Find the Power set of the given set without using loops

use map, reduce, lambda, filter

23rd Oct 2017, 12:58 PM
MAYUR ATKADE
MAYUR ATKADE - avatar
2 Answers
+ 4
Please give an example of the expected output for a given input.
23rd Oct 2017, 1:17 PM
Louis
Louis - avatar
- 1
input : {1,2,3} output : { {}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} } If given set has n elements than its Power set will have 2^n elements In given Example given set has 3 elements so its Power set has 2^3= 8 elements
23rd Oct 2017, 1:26 PM
MAYUR ATKADE
MAYUR ATKADE - avatar