Hi there I’ve checked the constraints and my code on Sublime as well using the test case on CB IDE but here none of the test cases are passing.
Kindly help.
Hi there I’ve checked the constraints and my code on Sublime as well using the test case on CB IDE but here none of the test cases are passing.
Kindly help.
Please share the code
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int m, n; cin >> m >> n;
int a[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
for (int j = 0; j < n; j++) {
if (j % 2 == 0) {
for (int i = 0; i < m; i++) {
cout << a[i][j] << ",";
}
}
else {
for (int i = m - 1; i >= 0; i--) {
cout << a[i][j] << ",";
}
}
}
cout << "END";
return 0;
}
I think there is supposed to be spaces that need to be printed as well.
Yes it helped. Thanks 