TEST CASES

how can i initialise arrays of size that is to be entered by the user i.e. the number of test cases. In several questions i need to store the information in this array for different test cases.

why don’t you look up the source code of some accepted solutions. You will get the idea. Secondly, if array initialization seems difficult to you, then learn the language properly in which you are coding your solution;

import java.util.Scanner;
public class ScanDyn{
public stativ void main (String…s){
Scanner scan =new Scanner(System.in);
System.out.println(“Enter the length of Array you require”);
String StrArray=new String(scan.nextInt());

}

}

It is the way to initilize Array at the run time in java.

If you want in c++
then simply
int n;
cout>>“Enter the size of Array”;
cin<<n;
int Co[n];

//