Count expressions reaching a target sum | Amazon Interview Question