logoalt Hacker News

theendisneytoday at 4:04 AM0 repliesview on HN

   coins = [100,50,25,10,5,1]
   change = 1234;
   result = [0,0,0,0,0,0];
   for(i=0:i<coins.length;i++){
     while(change>coins[i]){
       result[i]++;
       change-=coins[i];
     }
   }
   //[12,0,1,1,4]
Coudnt help myself sorry