loading...

Discussion on: Daily Challenge #82 - English Beggars

Collapse
kvharish profile image
K.V.Harish

My solution in js


const beggarsCollection = (collection, numOfBeggars) => {
  const sum = Array(numOfBeggars).fill(0);
  collection.forEach((value, index) => {
    sum[index % numOfBeggars] += value;
  });
  return sum;
};