Below is my solution and got the Run Time Error saying that : Last executed input: [[7],[9],[6]].

But I've tested that in my local environment and got the answer [7, 9, 6].

```
vector<int> spiralOrder(vector<vector<int> > &matrix) {
int m = matrix.size();
int n = 0;
if(m != 0) {
n = matrix[0].size();
}
vector<int> retVector(m*n);
int currentIndex =0;
for(int i=0; 2*i < m; i++) {
//Top
for(int j=i; j <= n-1-i; j++) {
retVector[currentIndex++] = matrix[i][j];
}
//Right
for(int j=i+1; j<= m-1-i; j++) {
retVector[currentIndex++] = matrix[j][n-1-i];
}
//Bottom
for(int j=n-2-i; j>=i; j--) {
retVector[currentIndex++] = matrix[m-1-i][j];
}
//Left
for(int j=m-2-i; j>i; j--) {
retVector[currentIndex++] = matrix[j][i];
}
}
return retVector;
}
```

Any suggestions?