my code for wave print column wise is passing the sample output but when i submit out the code it’s giving 0 test cases pass
Not passing all test cases
#include
using namespace std;
int main(){
int row,col;
cin>>row;
cin>>col;
int arr[row][col];
for(int i=0; i<row; i++)
{
for (int j=0; j<col; j++)
{
cin>>arr[i][j];
}
}
for(int j=0;j<col;j++){
if(j%2==0){
for(int i=0;i<row;i++){
cout<<arr[i][j]<<",";
}}
else {
for(int i=row-1;i>=0;i--)
cout<<arr[i][j]<<",";
}
}
cout<<"END";
return 0;
}


1 Like