← all problems

repeatText 🌶️

Your group chat needs a laugh. Write a method repeatText that takes a String s and an int n and returns s repeated n times in a row. If n is 0, return the empty String.

For example, repeatText("ha", 3) is "hahaha", and repeatText("go ", 2) is "go go ".