In this post, we will solve **Array of N Elements HackerRank Solution**. This problem **(Array of N Elements)** is a part of **HackerRank Functional Programming** language.

**Task**

Create an array of * n* integers, where the value of

*is passed as an argument to the pre-filled function in your editor. This challenge uses a custom checker, so you can create*

**n***any*array of

*integers. For example, if*

**n****, you could return**

*n*= 4**[1, 1, 1, 1]**,

**[1, 2, 3, 4]**, or any other array of equal length.

**Note:** Code stubs are provided for almost every language in which you must either fill in a blank (i.e., `____`

) or write your code in the area specified by comments.

**Method Signature**

```
Number Of Parameters: 1
Parameters: [n]
Returns: List or Vector
```

**Input Format**

A single integer, * n*.

**Constraints**

**1 <=***n*<= 100- The members returned by the list/vector/array must be integers.

**Output Format**

The function must return an array, list, or vector of * n* integers. Stub code in the editor prints this to stdout as a space, comma, or semicolon-separated list (depending on your submission language).

**Note:** Your output need not match the *Expected Output* exactly; the size of your printed list is confirmed by a custom checker, which determines whether or not you passed each test case.

**Sample Input 0**

`10`

**Sample Output 0**

`[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]`

**Sample Input 1**

`3`

**Sample Output 1**

`[1, 2, 3]`

**Solution – Array of N Elements – HackerRank Solution**

**Scala**

object Solution extends App { def f(num: Int): List[Int] = (0 until num).toList def readInt(): Int = scala.io.StdIn.readInt() println(f(readInt)) }

**Note:** This problem **(Array of N Elements)** is generated by **HackerRank** but the solution is provided by **CodingBroz**. This tutorial is only for **Educational** and **Learning** purpose.