Type an input and write what you think is the output . Each problem is converted to Web Assembly, so any possible input will show the corresponding output. Only correct predictions count.
Locked until you have predicted 3 outputs correctly.
| 1 | vector<vector<int>> solution(vector<vector<int>> grid) { |
| 2 | |
| 3 | int n = grid.size(); |
| 4 | |
| 5 | for (int r = 0; r < n; r++) { |
| 6 | for (int c = r + 1; c < n; c++) { |
| 7 | swap(grid[r][c], grid[c][r]); |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | for (int r = 0; r < n; r++) { |
| 12 | reverse(grid[r].begin(), grid[r].end()); |
| 13 | } |
| 14 | |
| 15 | return grid; |
| 16 | } |
Names have been stripped. The signature is the only clue you get for free. Compiled as C++20 with the standard headers and using namespace std; already in scope.