Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, December 9, 2012

Codecademy: Codeyear The Fibonacci Beanstalk


//sample solution


function growBeanstalk(years) {
  // Base case
  if (years <= 2) {
    return 1;
  }
  // Recursive case
  return growBeanstalk(years - 1) + growBeanstalk(years - 2);
}

// Set the height of the beanstalk using your function
var height = growBeanstalk(29);

console.log(height);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts