728x90
https://school.programmers.co.kr/learn/courses/30/lessons/181833
📝 나의 풀이
using System;
public class Solution {
public int[,] solution(int n) {
int[,] answer = new int[n,n];
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(i==j) {
answer[i,j]=1;
}
}
}
return answer;
}
}
728x90
'코딩테스트 > [C#] 프로그래머스' 카테고리의 다른 글
[프로그래머스 | C# | Lv.0] l로 만들기 (0) | 2023.09.07 |
---|---|
[프로그래머스 | C# | Lv.0] 할 일 목록 (0) | 2023.09.07 |
[프로그래머스 | C# | Lv.0] 문자 리스트를 문자열로 변환하기 (0) | 2023.09.06 |
[프로그래머스 | C# | Lv.0] 뒤에서 5등까지 (0) | 2023.09.05 |
[프로그래머스 | C# | Lv.0] 순서 바꾸기 (0) | 2023.09.05 |