[해커랭크] [Easy] Java 1D Array

2021. 3. 10. 20:09알고리즘/해커랭크

728x90
반응형
SMALL

 

 

🌈 Solution.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.*;
 
public class Solution {
 
    public static void main(String[] args) {
       
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        
        for (int i = 0; i < a.length; i++) {
            a[i] = scan.nextInt();
        }
 
        scan.close();
 
        // Prints each sequential element in array a
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);
        }
    }
}
cs

 

👩‍💻 풀어보기 👨‍💻 https://www.hackerrank.com/challenges/java-1d-array-introduction/problem

 

Java 1D Array | HackerRank

Get started with one-dimensional arrays.

www.hackerrank.com

 

728x90
반응형
LIST

'알고리즘 > 해커랭크' 카테고리의 다른 글

[해커랭크] [Easy] Java List  (0) 2021.05.25