Explanation

494.Print the Multiplication Table of a Number

Easy
Given an integer n, return its multiplication table — n × 1 through n × 10 — as an array of 10 values. The for loopFor LoopWalking i from 1 to 10, computing n × i each time and collecting the result. version is the school-taught multiplication table, produced mechanically. The range-and-mapRange, MappedGenerating the fixed range 1 through 10 first, then transforming every value with a "multiply by n" function — separating "what values" from "what to do with them." version separates generating the positions (1 through 10) from the transformation applied to them (× n), a pattern that generalizes well beyond just multiplication tables.

Example 1:

Input: n = 5

Output: [5,10,15,20,25,30,35,40,45,50]

Example 2:

Input: n = 1

Output: [1,2,3,4,5,6,7,8,9,10]

Example 3:

Input: n = 0

Output: [0,0,0,0,0,0,0,0,0,0]

+ 2 hidden test cases run on Submit.

Constraints:

  • ●-100 ≤ n ≤ 100

n =

5