본문 바로가기
Leetcode

Leetcode <Sort> 1366. Rank Teams by Votes 50.6% Medium

by tiit 2020. 4. 10.
반응형

In a special ranking system, each voter gives a rank from highest to lowest to all teams participated in the competition.

The ordering of teams is decided by who received the most position-one votes. If two or more teams tie in the first position, we consider the second position to resolve the conflict, if they tie again, we continue this process until the ties are resolved. If two or more teams are still tied after considering all positions, we rank them alphabetically based on their team letter.

Given an array of strings votes which is the votes of all voters in the ranking systems. Sort all teams according to the ranking system described above.

Return a string of all teams sorted by the ranking system.

 

만약 2 or 더 많은 팀이 동점일 때 처음 포지션에서, 문제를 풀기위해 두 번째 포지션을 고려한다, 여기서도 동점이면 계속해서 이 과정을 반복. 모든 포지션이 동점이면 알파벳순으로 랭크를 한다.

주어진 문자 배열은 투표들이다. 

이것으로 모든 팀의 랭킹을 정렬하라.

랭킹 시스템에 의해 정렬된 팀의 문자를 반환

 

예는 Leectcode에서 보슈 , 해석은 내맘대로 했습니다,,

반응형

댓글