Rank the Top Two Competition Teams
Updated
Problem statement
Four aligned arrays describe each team. Team i earns 3 * wins[i] + draws[i] points and has difference scored[i] - conceded[i].
Rank teams by points descending, then difference descending, then index ascending. Return the indices of the top two teams.
Function
topTwoTeams(wins: int[], draws: int[], scored: int[], conceded: int[]) → int[]Examples
Example 1
wins = [3,2,1]draws = [0,2,5]scored = [5,5,5]conceded = [1,1,1]return = [0,1]The primary point totals determine the top two.
Example 2
wins = [2,2,1]draws = [0,0,3]scored = [10,7,9]conceded = [4,4,4]return = [0,2]Equal points are ordered by larger scored-minus-conceded difference.
Constraints
2 <= wins.length <= 100000- All four arrays have equal length and contain values from 0 through 100000.
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Build the Task HierarchyPendo · OA
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
- Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
- Rank Football TeamsCapital One · OACapital One interview questions
- Maximum Apples That Fit in a BoxVirtu Financial · OAVirtu Financial interview questions
- Rank Football TeamsPersona · OAPersona interview questions
- Meandering ArrayVerisk · OA
- Minimum Magic Stones After MergesElevenLabs · OAElevenLabs interview questions