Problem · Array

Find Largest Number (Google Early Career)

Learn this problem
EasyGoogleFULLTIMEOA
See Google hiring insights

Problem statement

You are given an array of decimal digits with length at least 3. Choose three elements while preserving their original left-to-right order and concatenate them into a three-digit integer.

Return the largest integer that can be formed. The visible example establishes the order-preserving requirement: from [7,4,3,8,2], the answer is 782.

Function

findLargestNumber(nums: int[]) → int

Examples

Example 1

nums = [7, 4, 3, 8, 2]return = 782
🐹🐹

Constraints

  • 3 <= nums.length <= 10^5
  • 0 <= nums[i] <= 9

More Google problems

drafts saved locally
public int findLargestNumber(int[] nums) {
  // write your code here
}
nums[7, 4, 3, 8, 2]
expected782
checking account