WA in Stupid Machine Problem Code: STUPMACH

Please tell me where i am wrong.My solution

Possible solution:
try deleting all elements that comes after 0 in each iteration.
so,the array would be like:
2 2 3 1 4
1 1 2 //applied - min_element and deleted element after zero

please tell me how answer is 11.Thanks for replying:grinning:

I was using int for ans but it was exceeding the range of int that’s i was getting WA.My bad

1 Like

exteremly sorry your code was correct for my test case. :expressionless:

1 Like

Its ok bro.

1 Like

100 100 100
answer should be 300 i think