Solved

Consider the Problem of Arranging Matchsticks So as to Form

Question 60

Multiple Choice

Consider the problem of arranging matchsticks so as to form a row of rectangles, as shown below.-----
|--|--|---
Complete the recursive method below, which is designed to return the number of matchsticks needed to form n rectangles.
Public static int matchsticks(int rectangles)
{
If (rectangles == 1) // 1 square can be formed with 6 matchsticks
{
Return 6;
}
Else
{
Return ___________________________
}
}


A) 6 + matchsticks(rectangles - 1) ;
B) 5 + matchsticks(rectangles - 1) ;
C) 6 * rectangles;
D) matchsticks(rectangles + 6) ;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions