문제
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.
제약 조건
-1,000 ≤ number ≤ 1,000; 0 ≤ count ≤ 100
예시
입력:
number = 3
count = 5
예상 출력:
expected = [3, 6, 9, 12, 15]
입력:
long long number = 3;
long long count = 5;
예상 출력:
std::vector<long long> expected = {3, 6, 9, 12, 15};
입력:
long number = 3;
long count = 5;
예상 출력:
long[] expected = new long[] {3, 6, 9, 12, 15};
설명
3×1, 3×2, 3×3, 3×4, 3×5 = 3, 6, 9, 12, 15.
입력:
number = 7
count = 0
예상 출력:
expected = []
입력:
long long number = 7;
long long count = 0;
예상 출력:
std::vector<long long> expected = {};
입력:
long number = 7;
long count = 0;
예상 출력:
long[] expected = new long[] {};
설명
Zero multiples were requested, so the list is empty.
접근 방법
먼저 스스로 풀어 본 뒤 힌트를 하나씩 열어 보세요.
힌트 1
Each entry is the same number multiplied by a growing counter.
힌트 2
Build the results in order from 1 through the requested count.
힌트 3
If the count is zero, the result should be an empty list.
예상 복잡도
O(count) time, O(count) extra space
참고 자료
이 문제는 CodeUtility에 맞게 수정되었습니다. 위의 설명과 제약 조건을 기준으로 풀어 주세요.