The Elves in accounting are thankful for your help; one of them even offers you a starfish coin they had left over from a past vacation. They offer you a second one if you can find three numbers in your expense report that meet the same criteria.
For example, again using the same expense report:
1721, 979, 979, 366, 299, 675, 1456
The three entries that sum to \(2020\) are \(979\), \(366\), and \(675\). Multiplying them together produces the answer, \(241861950\).
Write a static function repair
that takes a sequence (List
) of positive numbers (int
). The function must return the product (int
) of the three numbers in the sequence that sum to 2020.
This static function must be located in the class Submission
.
> Submission.repair(Arrays.asList(1721, 979, 979, 366, 299, 675, 1456))
241861950