Search found 1 match

by elimirks
Wed Aug 24, 2016 10:34 pm
Forum: Challenges Solved
Topic: Growing Bacteria
Replies: 24
Views: 7876

There haven't been any recursive solutions posted yet, so here's mine. By plugging in the numbers, you find a recursive formula: 2T(n-1)-T(n-3), with base cases of T(0)=1, T(1)=2, T(2)=4, T(3)=7, T(4)=11. I used dynamic programming to speed it up. cache = dict() # n is the number of days def T(n): i...