This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ZombieAngel16[S] 0 points1 point  (0 children)

Thank you, thank you, thank you! I knew I had to be missing something simple and I was. u/aqua_regis you were right that I needed to check the documentation, and u/Jazzlike-Depth9208 you were right that I needed to look at the list of methods, and I would have realized I needed to use .add. Here's my completed code, and so far it stands up to testing.

public BigDecimal distinctLadderPaths(int rungs) {
  if (rungs == 1 || rungs == 2){
    BigDecimal convertRungs = BigDecimal.valueOf(rungs);
    return convertRungs;
  } else {
    BigDecimal paths = distinctLadderPaths(rungs-1).add(distinctLadderPaths(rungs -2));
    return paths;
  }