Problem
Build one row of a multiplication table: number × 1, number × 2, … up to number × count.
Implement multiplication_row(number, count).
Input
number: The number to multiply. count: How many multiples to list.
Output
Return the list of multiples in order.
Constraints
-1,000 ≤ number ≤ 1,000; 0 ≤ count ≤ 100
Examples
Input:
count = 5
number = 3
Expected output:
expected = [3, 6, 9, 12, 15]
Input:
long long count = 5;
long long number = 3;
Expected output:
std::vector<long long> expected = {3, 6, 9, 12, 15};
Input:
long count = 5;
long number = 3;
Expected output:
long[] expected = new long[] {3, 6, 9, 12, 15};
Explanation
3×1, 3×2, 3×3, 3×4, 3×5 = 3, 6, 9, 12, 15.
Input:
count = 0
number = 7
Expected output:
expected = []
Input:
long long count = 0;
long long number = 7;
Expected output:
std::vector<long long> expected = {};
Input:
long count = 0;
long number = 7;
Expected output:
long[] expected = new long[] {};
Explanation
Zero multiples were requested, so the list is empty.
How to approach it
Try on your own first, then open one hint at a time.
Hint 1
Each entry is the same number multiplied by a growing counter.
Hint 2
Build the results in order from 1 through the requested count.
Hint 3
If the count is zero, the result should be an empty list.
Expected complexity
O(count) time, O(count) extra space
References
This challenge is adapted for CodeUtility. Follow the statement and constraints above.