1
2
3
4
5
6
7
8
9
|
string[] WinningScores = new string[] {"g", "o", "g", "o", "g", "o" };
var duplicates =
WinningScores
.Select((score, index) => new { score, player = index + 1 })
.GroupBy(x => x.score, x => x.player)
.Where(gxs => gxs.Count() > 1);
Console.WriteLine("duplicates: {0}", duplicates.Count());
|
cs |
출력 값은 2
g, o 두개가 중복되기 때문
'c# > problems' 카테고리의 다른 글
Photon Create Room Failed 오류 - 해결 (0) | 2020.07.01 |
---|---|
유니티 material missing 뜨는 이유 - 해결! (0) | 2020.06.26 |
문제 출제 답안 정리 (0) | 2020.06.16 |
Model에 Animator 입히기 (0) | 2020.06.14 |