Problem · Array
Biggest Number From Digits
Learn this problemProblem statement
There is an array, named digits, consisting of N digits.
Choose at most three digits (not necessarily adjacent) and merge them into a new integer without changing the order of the digits. What is the biggest number that can be obtained this way?
Write a function:
googleBiggestNumberOfDigits(int[] arr)
that, given an array of N digits, returns the biggest number that can be built.
Assume that:
N is an integer within the range [3..50];'digits', is an integer within the range [0..9].In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment.
Function
googleBiggestNumberOfDigits(digits: int[]) → intExamples
Example 1
digits = [7, 2, 3, 3, 4, 9]return = 749The biggest number that can be obtained by choosing at most three digits without changing the order is 749.
Example 2
digits = [0, 0, 5, 7]return = 57The biggest number that can be obtained by choosing at most three digits without changing the order is 57.
Constraints
N is an integer within the range [3..50]Each element of array, named digits, is an integer within the range [0...9]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