this is not passing the 3rd condition
package com.codegym.task.task07.task0705;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Arrays;
/*
One large array and two small ones
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner read = new Scanner(System.in);
int [] arr = new int[20];
for(int i = 0; i < 20; i++) {
arr[i] = read.nextInt();
}
int [] first = Arrays.copyOfRange(arr, 0, 10);
int [] sec = Arrays.copyOfRange(arr, 10, 20);
for(int i = 0; i<10; i++){
System.out.println(sec[i]);
}
}
}
what is wrong with this code
Resolved
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
ThomasLC
24 May 2019, 03:34solution
Try doing creating your smaller arrays first, then using the copy method in a separate line
i.e
int [] first = new int[10];
int [] sec = new int[10];
cause condition 3 calls specifically for the creation of the smaller int arrays first
condition 4 then asks you to copy them.
Nothing wrong with your code, just that codegym sometimes has very specific conditions, and the order of it affects the verification.
+2
Nithin
24 May 2019, 03:49
Thank you so much it worked.
0