import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int [][]arr=new int[n][m];
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr.length;j++){
arr[i][j]=sc.nextInt();
}
System.out.println();
}
rowprint(arr);
sc.close();
}
public static void rowprint(int [][]arr){
for(int i=0;i<arr.length;i++){
if(i%2==0){
for(int j=0;j<arr.length;j++){
System.out.print(arr[i][j]+", β);
}
}
else{
for(int j=arr.length-1;j>=0;jβ){
System.out.print(arr[i][j]+β, ");
}
}
}
System.out.print(βENDβ);
}
}
Here i am getting correct output but my test cases are wrong
Hello Shubham,
Please let us know whether you are getting every test case failed, or getting some of the test cases failed.
Please give us the detailed test case detail.
After then We will proceed further.
all the testcases are wrong but output is correct
shubham in that case please check your print statement that you are printing according to the requirement like space between two letters or we shoud print END at the last or not please check it.
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.