You are viewing a single comment's thread. Return to all comments →
A simple version to your code:
private static int stepPerms(int n) { if(n < 0) return 0; if(n == 0) return 1; return map.computeIfAbsent(n, key -> stepPerms(key-1) + stepPerms(key-2) + stepPerms(key-3)); }
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 →
A simple version to your code: