Rank Teams by Votes
Updated
Problem statement
Each vote ranks the same teams from highest to lowest. Rank teams by the number of first-place votes; break ties using second-place votes, then later positions, and finally alphabetical order.
Function
rankTeams(votes: String[]) → StringExamples
Example 1
votes = ["ABC","ACB","ABC","ACB","ACB"]return = "ACB"Team A is always first; C has more second-place votes than B.
Constraints
1 <= votes.length <= 1000- Each vote contains the same distinct uppercase teams.
- There are at most
26teams.
More Atlassian Online Assessment questions
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Top K Frequent ElementsAmazon · OA · PHONE SCREEN
- Count Servers With No Requests in a Time WindowIBM · OAIBM interview questions
- Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
- Minimum Distinct Prefix CostChubb · OAChubb interview questions
- Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
- Convert Sparse Records to a Filled TableNetflix · OANetflix interview questions
- Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
- Aggregate Paginated Project Run RecordsReplit · OA
- Efficient TeamsExpedia · OAExpedia interview questions
- One-Hot String MatrixIntuit · OAIntuit interview questions