Sample test case is wrong or confusing so please dont waste ur tim


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.