Rank Common Translation Mistakes
Updated
Problem statement
Learners submit translations of the same sentence. You are given submissions, where every row contains the translated words in their sentence positions.
For each position independently, find its greatest word frequency. Every word tied for that greatest frequency is considered correct at that position. Every occurrence of any other word at that position is a mistake.
Aggregate the number of mistaken occurrences for each word across all positions and submissions. Return each distinct mistake word exactly once, ordered by decreasing mistake frequency. When two mistake words have the same frequency, order them alphabetically.
Function
countingMistakes(submissions: String[][]) → String[]Examples
Example 1
submissions = [["your","bear","drinks","beer"],["your","bear","eats","beer"],["the","bear","drinks","beer"]]return = ["eats","the"]At position 0, your is modal and the is one mistake. At position 2, drinks is modal and eats is one mistake. Both mistake frequencies are 1, so alphabetical order places eats before the.
Example 2
submissions = [["your","bear","drinks","beer"],["your","bear","eats","beer"],["the","bear","drinks","beer"],["your","bear","the","beer"]]return = ["the","eats"]The word the is mistaken once at position 0 and once at position 2, for a total of 2. The word eats is mistaken once, so the appears first.
Constraints
1 <= submissions.length <= 1000.1 <= submissions[i].length <= 100, and every submission has the same length.- Every word has length from
1through30. - Words contain only lowercase letters
athroughzand digits0through9. - The same word may occur more than once in one submission.
More Duolingo interview questions
- Bouncing Square Reaches a Screen CornerOA · Seen Dec 2024
- Most-Read Page Across Every Valid StorylineOA · PHONE SCREEN · Seen Oct 2022
- Shortest Route Through a Traced MazeOA · Seen Sep 2022
- Count Distinct Word MeaningsOA · Seen Sep 2021
- Count Legal Outfit CombinationsOA · Seen Sep 2021
- Group Timestamps into Consecutive-Day IntervalsPHONE SCREEN · Seen Nov 2026
- Return Every Matching DecryptionPHONE SCREEN · Seen Nov 2026
- Visit Desired Attractions Without Reusing a TrailPHONE SCREEN · Seen Oct 2026
- Correct an In-Place Array ReversalPHONE SCREEN · Seen Oct 2026
- Count Starts Reaching a Grid MaximumPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Decode Words with Anagram KeysCresta · OACresta interview questions
- Longest String ChainVisa · OAVisa interview questions
- Frequently Bought TogetherAmazon · OA
- Maximize Palindromic WordsSquarepoint Capital · OASquarepoint Capital interview questions
- Aggregate Paginated Project Run RecordsReplit · OA
- Parse and Filter Chargeback DisputesStripe · OAStripe interview questions
- Count User Logins 🌿 (Singapore)PayPal · OAPayPal interview questions
- Largest Lexicographical Substring 🌿Google · OAGoogle interview questions
- Count Distinct Message MentionsZipRecruiter · OAZipRecruiter interview questions
- Aggregate Investment Ownership from CSVCarta · OA · PHONE SCREEN