Employee With the Highest Salary
Updated
Problem statement
You are given two arrays of equal length:
names[i]is the name of thei-th employee.salaries[i]is that employee's salary.
Return the name of the employee with the highest salary. If several employees share the highest salary, return the name that appears first in the input.
Function
highestSalaryName(names: String[], salaries: int[]) → StringExamples
Example 1
names = ["Ava","Ben","Chen"]salaries = [70000,92000,85000]return = "Ben"Ben has the largest salary, 92000.
Example 2
names = ["Mina","Noah","Omar"]salaries = [50000,61000,61000]return = "Noah"Noah and Omar tie for the highest salary, so return the earlier name.
Example 3
names = ["Zoe"]salaries = [0]return = "Zoe"The only employee is the answer.
Constraints
1 <= names.length = salaries.length <= 10^5.names[i]is non-empty.0 <= salaries[i] <= 10^9.
More Mastercard Phone Screen questions
- Top Three Accounts by Monthly Transaction AmountPHONE SCREEN · Seen Sep 2026
- Deduplicate a List While Preserving OrderPHONE SCREEN · Seen Jul 2026
- Group Names by DepartmentPHONE SCREEN · Seen Jul 2026
- Credit and Debit Transaction Counts per UserPHONE SCREEN · Seen Apr 2026
- Users with Three Transactions in Sixty SecondsPHONE SCREEN · Seen Apr 2026
- Container With Most WaterPHONE SCREEN · Seen Oct 2025
- Employees with the Highest and Lowest SalaryPHONE SCREEN · Seen Apr 2025
- Inactive Customers with Prior ActivityPHONE SCREEN · Seen Nov 2024
- Merchant Category Transaction SummaryPHONE SCREEN · Seen Nov 2024
- Top Customers by Six-Month Transaction AmountPHONE SCREEN · Seen Nov 2024
Similar questions at other companies
- Lazy Filter over a GeneratorSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
- Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
- Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
- Array-Backed Set Without Library CollectionsOde with Anthropic · PHONE SCREEN
- Paginate Retained Conversation HistorySierra · PHONE SCREENSierra interview questions
- Validate a Chess Bishop, Rook, or Queen MoveGlean · PHONE SCREENGlean interview questions
- Count Distinct Underwriting PII ValuesAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
- Apply Affine Array TransformationsByteDance · PHONE SCREENByteDance interview questions
- Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
- Bounded IPv4 FilterAmazon · PHONE SCREEN