Learn
Exam

Array Multiplication

Difficulty
STARTER

Problem

Given an array numbers consisting of natural numbers and a natural number n, write a function solution that returns the result of repeating the numbers array n times.


Constraints

  • Each element in numbers is a natural number not exceeding 20.
  • numbers is not empty, and its length does not exceed 10.
  • n is a natural number not exceeding 10.

Test Case

Test Case Number numbers n return
1 [1] 2 [1, 1]
2 [1] 5 [1, 1, 1, 1, 1]
3 [1, 2, 3] 3 [1, 2, 3, 1, 2, 3, 1, 2, 3]

Explanation for Test Case 1

  • Repeating numbers = [1] 2 times results in [1, 1].

Explanation for Test Case 2

  • Repeating numbers = [1] 5 times results in [1, 1, 1, 1, 1].

Explanation for Test Case 3

  • Repeating numbers = [1, 2, 3] 3 times results in [1, 2, 3, 1, 2, 3, 1, 2, 3].