# Array of N Elements – HackerRank Solution

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

Create an array ofÂ nÂ integers, where the value ofÂ nÂ is passed as an argument to the pre-filled function in your editor. This challenge uses a custom checker, so you can createÂ anyÂ array ofÂ nÂ integers. For example, ifÂ n = 4, you could returnÂ [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