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.

Contents

**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.