We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Functional Programming
  3. Introduction
  4. Array Of N Elements

Array Of N Elements

Problem
Submissions
Leaderboard
Discussions
Editorial

Create an array of 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 any array of integers. For example, if , you could return , , 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, .

Constraints

  • The members returned by the list/vector/array must be integers.

Output Format

The function must return an array, list, or vector of 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]

Author

idlecool

Difficulty

Easy

Cutoff Score

10.00

Max Score

10

Submitted By

25261

Need Help?


View discussions
View editorial
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy