Sum of the products of all possible subsets with size less than k
Answers
Explanation:
Input : arr[] = {1, 2, 3}
Input : arr[] = {1, 2, 3}Output : 23
Input : arr[] = {1, 2, 3}Output : 23Possible Subset are: 1, 2, 3, {1, 2}, {1, 3},
Input : arr[] = {1, 2, 3}Output : 23Possible Subset are: 1, 2, 3, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}
Input : arr[] = {1, 2, 3}Output : 23Possible Subset are: 1, 2, 3, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}Products of elements in above subsets :
Input : arr[] = {1, 2, 3}Output : 23Possible Subset are: 1, 2, 3, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}Products of elements in above subsets :1, 2, 3, 2, 3, 6, 6
Input : arr[] = {1, 2, 3}Output : 23Possible Subset are: 1, 2, 3, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}Products of elements in above subsets :1, 2, 3, 2, 3, 6, 6Sum of all products = 1 + 2 + 3 + 2 + 3 + 6 + 6
Input : arr[] = {1, 2, 3}Output : 23Possible Subset are: 1, 2, 3, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}Products of elements in above subsets :1, 2, 3, 2, 3, 6, 6Sum of all products = 1 + 2 + 3 + 2 + 3 + 6 + 6 = 23
Hope it helps ❣️