'Failed to compile judge: judge.java:1: error: class, interface, or enum expected 1
This is the question link of Google Code Jam Round 1A: https://codingcompetitions.withgoogle.com/codejam/round/0000000000877ba5/0000000000aa8fc1
I am trying to take input but I am getting this error :
Failed to compile judge: judge.java:1: error: class, interface, or enum expected
1
This is the code :
import java.io.;
import java.util.;
class Solution{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int k=1; k<=t; k++){
int n = sc.nextInt();
int[] arr = new int[2*n];
int i=0;
for(; i<n; i++){
arr[i] = i+1;
System.out.print(arr[i]+" ");
}
for(; i<2*n; i++) arr[i] = sc.nextInt();
}
}
}
Please tell me, Why am I getting error?
Solution 1:[1]
for(; i<2*n; i++) arr[i] = sc.nextInt();
this is probably your problem
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kesaven |
