Question: Problem Statement: There is an array, named digits, consisting of N digits. Choose at most three digits ( not necessarily adjacent ) and merge them

Problem 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: python def solution(digits) that, given an array of N digits, returns the biggest number that can be built. Examples: Given digits =[7,2,3,3,4,9], the function should return 749. Given digits =[0,0,5,7], the function should return 57. Assumptions: N is an integer within the range 3..503..50; Each element of the array digits is an integer within the range 0..90..9. Focus on correctness in your solution; performance is not the main focus. Java Code Stub: java class Solution { public static int solution(int[] A){ System.err.println("Tip: Use System.err.println() to write debug messages on the output tab."); return 0; }} Test Cases: Test 1: Input: [7,2,3,3,4,9] Output: 749 Test 2: Input: [0,0,5,7] Output: 57

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!