From 7869b6c516fb1dec766e7d235ab6917843e168d1 Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Tue, 8 Sep 2026 22:40:55 +0900 Subject: [PATCH] 1886. Determine Whether Matrix Can Be Obtained By Rotation --- ...r Matrix Can Be Obtained By Rotation.java" | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/1886. Determine Whether Matrix Can Be Obtained By Rotation.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/1886. Determine Whether Matrix Can Be Obtained By Rotation.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/1886. Determine Whether Matrix Can Be Obtained By Rotation.java" new file mode 100644 index 00000000..ed23df38 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/1886. Determine Whether Matrix Can Be Obtained By Rotation.java" @@ -0,0 +1,47 @@ +/* + +1. 아이디어 : mat을 90, 180, 270, 360도로 배열을 회전했을때 target과 일치하면 true, 아니면 false + 배열 회전 공식을 사용한다. + +2. 시간복잡도 : O(N^2*3) + +3. 자료구조/알고리즘 : 완전탐색 + + */ + +class Solution { + public boolean findRotation(int[][] mat, int[][] target) { + + boolean check; + int n = mat.length; + + // 90도 회전해서 가능하면 true + for(int cnt=0; cnt<4; cnt++) { + if(cnt>0) mat = rotate90(mat, n); + + check = true; + for(int i=0; i