X264: Recursion Programming Exercise: Multiply

For function multiply, write the missing base case condition and action. This function will multiply two numbers x and y. You can assume that both x and y are positive.

Examples:

multiply(2, 3) -> 6

Your Answer:

x
 
1
public int multiply(int x, int y) {
2
  if <<Missing base case condition>> {
3
    <<Missing base case action>>
4
  } else {
5
    return multiply(x - 1, y) + y;
6
  }
7
}
8

Feedback

Your feedback will appear here when you check your answer.