Find all subset of length 2 and 3 whose sum is divisible by 3
Answers
Answered by
6
Answer:
Input : arr[] = {1, 2, 3};
m = 3;
Output : 3
Subsequence of given set are
{1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3} and {1, 2, 3}.
And their sums are 1, 2, 3, 3, 5, 4 and 6.
Input : arr[] = {1, 2, 3, 4};
m = 2;
Output : 7
{2}, {4}, {1, 3}, {2, 4}, {1, 2, 3}, {1, 3, 4}
and {1, 2, 3, 4}
Similar questions
India Languages,
5 months ago
Science,
5 months ago
Math,
10 months ago
Math,
1 year ago
Math,
1 year ago