Want to know:
先swap upside down,再symmetric (转置) // first upside down for(int i=0; i<n/2; i++){ for(int j=0; j<n; j++){ int temp = matrix[i][j]; matrix[i][j] = matrix[n-1-i][j]; matrix[n-1-i][j] = temp; } } // then swap symmetrically for(int i=0; i<n; i++){ for(int j=i+1; j<n; j++){ int temp = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = temp; } }
Get a detailed, AI-powered explanation for this question and thousands more on StudyFetch.
Get the Answer for FreeHow StudyFetch Helps You Master This Topic
AI-Powered Answers
Get instant, detailed explanations powered by AI that understands your course material.
Deep Understanding
Go beyond surface-level answers with step-by-step breakdowns and examples.
Personalized Learning
Sparky adapts to your learning style and helps you connect ideas.
Practice & Test
Turn any question into flashcards, quizzes, and practice tests to solidify your knowledge.
Explore More Questions
- backtracking public void backtracking(List<List<Integer>> res, List<Integer> tmp, int num, int tmpSum, int k, int n) { if (tmp.size() == k && tmpSum == n) { res.add(new ArrayList<Integer>(tmp)); return; } for (int i = num; i <= 9; i++) { if (tmpSum + i <= n) { tmp.add(i); backtracking(res, tmp, i + 1, tmpSum + i, k, n); tmp.remove(tmp.size() - 1); } } }
- Si un triangle a une base de 6 cm et une hauteur de 7 cm, l'aire est:
- chap-4: Toute application linéaire de E de dimension finie à valeurs dans F (quelconque) est continue