Remove Stones to Minimize the Total
You are given a list of piles of stones, where piles[i] is the number of stones in the ith pile. You need to remove some stones from the piles so that you have the smallest possible total number of stones.
Choose any pile and remove x stones from it. If the pile contains fewer than x stones, then remove all the stones from it. Repeat this process until all the piles contain fewer than x stones.
Return the smallest possible total number of stones after removing some stones.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)