Comment body goes here.
It’s not wrong.
If a element is present ‘n’ times in the input array , then it can be used at max ‘n’ times to calculate the sum (not infinitely).
Please don’t mislead other people.
testcases are fine. There is problem in your code or your approach.