MCPcopy Create free account
hub / github.com/careercup/ctci / countWaysRecursive

Method countWaysRecursive

java/Chapter 9/Question9_1/Question.java:20–28  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

18 }
19
20 public static int countWaysRecursive(int n) {
21 if (n < 0) {
22 return 0;
23 } else if (n == 0) {
24 return 1;
25 } else {
26 return countWaysRecursive(n - 1) + countWaysRecursive(n - 2) + countWaysRecursive(n - 3);
27 }
28 }
29
30 public static void main(String[] args) {
31 for (int i = 0; i < 30; i++) {

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected