Don't know what's wrong with my solution? This solution showing expected result locally, but in oj it's showing wrong answer for

input: [[1,2],[3,4]]

Output: [[1,2],[3,4]]

Expected: [[3,1],[4,2]]

Locally I am getting [[3,1],[4,2]]

Here is my code:

```
public class Solution {
public void rotate(int[][] matrix) {
int l = matrix.length;
int[][] res = new int[l][l];
for(int i = 0; i < l; i++){
for(int j = 0; j < l; j++){
res[j][l-1-i] = matrix[i][j];
}
}
matrix = res;
}
}
```