Solved LeetCode program · 555 of 1,000
#0781 · Rabbits in Forest
Original English source
The answers is a list of 1, 1, and 2, while the limit is 1000. The counts is a list of 1001 zeros.
For each answer in answers.
Increase item answer of counts by 1.
The total is 0.
For every spoken from 0 to limit.
If item spoken of counts is more than 0.
The group is spoken plus 1. The groups is (item spoken of counts plus spoken) divided by group. Add groups times group to total.
Show total.
Expected stdout
5