Write a recursive method called repeat that accepts a string and an integer as parameters and that

Question:

Write a recursive method called repeat that accepts a string and an integer as parameters and that returns concatenated together times. For example, repeat("hello", 3) returns "hellohellohello", and repeat( "ok", 1) returns "ok", and repeat( "bye", 0) returns "". String concatenation is an expensive operation, so for an added challenge try to solve this problem while performing fewer than concatenations.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: