126. 특별한 이차원 배열 1

김해준's avatar
Dec 24, 2025
126. 특별한 이차원 배열 1

사용언어 : Java

문제
notion image
풀이
/* 3(0,0)/(1,1)/(2,2) 1,0,0 0,1,0 0,0,1 6(0,0)/(1,1)/(2,2)/(3,3)/(4,4)/(5,5) 1,0,0,0,0,0 0,1,0,0,0,0 0,0,1,0,0,0 0,0,0,1,0,0 0,0,0,0,1,0 0,0,0,0,0,1 */ class Solution { public int[][] solution(int n) { int[][] answer = new int[n][n]; for(int i = 0 ; i < n; i++) { answer[i][i] = 1; } return answer; } }
notion image
Share article