Backtracking 2 - Aggregation - Backtracking / Aggregation and Memoization

https://algo.monster/problems/backtracking-aggregation

The template should be modified to return ‘ans’. Currently, it shows void in the signature.