# Category Archives: UIUC CS125 Codelab SolutionsUIUC CS125 Codelab Solutions

CS125 CodeLab Solutions

# CodeLab Solution 20857

Write a recursive, int -valued method , len, that accepts a string and returns the number of characters in the string . The length of a string is: 0 if the string is the empty string (""). ...

CS125 CodeLab Solutions

# CodeLab Solution 20856

The Fibonacci series: 0, 1, 1, 2, 3, 5, 8, 13, 21, has as its first 2 values , 0 and 1; each successive value if then calculated as the sum of the previous two values . The first element in the series...

CS125 CodeLab Solutions

# CodeLab Solution 20855

Given non-negative integers x and n, x taken to the nth power can be defined as: x to the 0th power is 1 x to the nth power can be obtained by multiplying x to the n-1'th...

CS125 CodeLab Solutions

# CodeLab Solution 20854

The sum of the numbers from 1 to n can be defined recursively as follows: The sum from 1 to 1 is 1. The sum from 1 to n is n more than the sum ...