https://school.programmers.co.kr/learn/courses/30/lessons/42578
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
using System;
using System.Collections.Generic;
public class Solution {
public int solution(string[,] clothes) {
int answer = 1;
Dictionary<string, int> dic = new Dictionary<string, int>();
for (int i = 0; i < clothes.GetLength(0); i++){
if(!dic.ContainsKey(clothes[i, 1])){
dic[clothes[i, 1]] = 1;
}
else{
dic[clothes[i, 1]]++;
}
}
foreach (var a in dic){
answer *= (a.Value + 1);
}
answer -= 1;
return answer;
}
}
728x90
반응형
'공부 > C#' 카테고리의 다른 글
[C#] 프로그래머스 동적 프로그래밍 - N으로 표현 (0) | 2025.03.09 |
---|---|
[C#] 프로그래머스 스택/큐 - 올바른 괄호 (0) | 2025.03.09 |
[C#] 프로그래머스 스택/큐 - 프로세스 (0) | 2025.03.09 |
[C#] 프로그래머스 스택/큐 - 기능개발 (0) | 2025.03.09 |
[C#] 코딩테스트 참고용 (0) | 2025.03.07 |