Sum of subsets in Elixir
Budget: ₹600 – ₹650 INR
Input:
array_of_digits : Array containing single digit numbers to satisfy sum
matrix_of_sum : A 2d matrix containing two digit numbers for which subsets are to be created
Output:
Map of each sum value and it’s respective subsets
Example:
array_of_digits = [3, 5, 2, 7, 4, 2, 3]
matrix_of_sum = [ [21 ,"na", "na", "na", 12], ["na", "na", 12, "na", "na"],["na", "na", "na", "na", "na"], [17, "na", "na", "na", "na"], ["na", 22, "na", "na", "na"] ]
Function should return a map:
%{
12 => [[3, 2, 7],[3, 7, 2],[3, 4, 5],[7, 5],[3, 2, 2, 5],[3, 2, 4, 3],[2, 7, 3],[3, 4, 2, 3],[7, 2, 3],[4, 5, 3],[2, 2, 5, 3]],
17 => [[3, 2, 7, 5],[3, 4, 7, 3],[3, 2, 7, 2, 3],[3, 2, 4, 5, 3]],
21 => [[3, 2, 4, 7, 5],[3, 2, 4, 7, 2, 3]],
22 => [[3, 4, 7, 5, 3], [3, 2, 7, 2, 5, 3]]
}
Sample python code for finding the subsets for every map: https://www.geeksforgeeks.org/perfect-sum-problem-print-subsets-given-sum/
array_of_digits : Array containing single digit numbers to satisfy sum
matrix_of_sum : A 2d matrix containing two digit numbers for which subsets are to be created
Output:
Map of each sum value and it’s respective subsets
Example:
array_of_digits = [3, 5, 2, 7, 4, 2, 3]
matrix_of_sum = [ [21 ,"na", "na", "na", 12], ["na", "na", 12, "na", "na"],["na", "na", "na", "na", "na"], [17, "na", "na", "na", "na"], ["na", 22, "na", "na", "na"] ]
Function should return a map:
%{
12 => [[3, 2, 7],[3, 7, 2],[3, 4, 5],[7, 5],[3, 2, 2, 5],[3, 2, 4, 3],[2, 7, 3],[3, 4, 2, 3],[7, 2, 3],[4, 5, 3],[2, 2, 5, 3]],
17 => [[3, 2, 7, 5],[3, 4, 7, 3],[3, 2, 7, 2, 3],[3, 2, 4, 5, 3]],
21 => [[3, 2, 4, 7, 5],[3, 2, 4, 7, 2, 3]],
22 => [[3, 4, 7, 5, 3], [3, 2, 7, 2, 5, 3]]
}
Sample python code for finding the subsets for every map: https://www.geeksforgeeks.org/perfect-sum-problem-print-subsets-given-sum/