Problem · Array
Focus on Correctness (2024 NG)
Learn this problemProblem statement
Given an array of digits, select up to 3 digits to form a number without changing their order. Return the largest possible number.
Note - When doing the assessment, they ask you to write your own test cases :)
Function
largestNumberPossible(digits: int[]) → intExamples
Example 1
digits = [7, 2, 3, 3, 4, 9]return = 749The largest number that can be formed by selecting up to 3 digits without changing their order is 749.
Constraints
1 ≤ digits.length ≤ 10^50 ≤ digits[i] ≤ 9- The relative order of selected digits must match their order in the input array.
More Google problems
- Deduplicate Logs: Keep FirstONSITE INTERVIEW · Seen Jul 2026
- Deduplicate Logs: Keep LatestONSITE INTERVIEW · Seen Jul 2026
- Find a Template Across Binary-Tree LeavesONSITE INTERVIEW · Seen Jul 2026
- Maximum Programmer-Problem MatchingONSITE INTERVIEW · Seen Jul 2026
- Minimum Direction ViolationsONSITE INTERVIEW · Seen Jul 2026
- Stream Latest Log VersionsONSITE INTERVIEW · Seen Jul 2026
- Stream Unique Logs in Timestamp OrderONSITE INTERVIEW · Seen Jul 2026
- Top-K IP Addresses from File RecordsONSITE INTERVIEW · Seen Jul 2026