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[i].length;j++) {
arr[i][j]=sc.nextInt();
}
}
printrowwise(arr);
sc.close();
}
public static void printrowwise(int [][]arr) {
for(int i=0;i<arr.length;i++) {
if(i%2==0) {
for(int j=0;j<arr[i].length;j++) {
System.out.print(arr[i][j]+",");
}
}
else {
for(int j=arr[i].length-1;j>=0;j–) {
System.out.print(arr[i][j]+",");
}
}
}
System.out.println(“END”);
}
}
Every testcases are wrong but output is correct
Hello Subham
Please give a blank after after you END statement then you will pass all the testcases
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.