You are viewing a single comment's thread. Return to all comments →
This is my Python2 code which I've used a memory.
memory = {1:1, 2:2, 3:4} def num_ways(n): if not n in memory.keys(): memory[n] = num_ways(n-1) + num_ways(n-2) + num_ways(n-3) return memory[n]
Seems like cookies are disabled on this browser, please enable them to open this website
Recursion: Davis' Staircase
You are viewing a single comment's thread. Return to all comments →
This is my Python2 code which I've used a memory.