Find Largest Number (Google Early Career)
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[]) → intExamples
Example 1
nums = [7, 4, 3, 8, 2]return = 782🐹🐹
Constraints
3 <= nums.length <= 10^50 <= nums[i] <= 9