


A = 5678, B = 45 and C = 769
The largest digit in ‘A’ is ‘8’, ‘B’ is ‘5’, and ‘C’ is ‘9’. The new number formed by concatenating the largest digit from each of these numbers is ‘859’. So, the answer is ‘859’.
The first line of input contains an integer ‘T’ which denotes the number of test cases. Then, the ‘T’ test cases follow.
The first and only line of each test case contains three space-separated numbers, ‘A’, ‘B’, and ‘C’, denoting the given numbers.
For every test case, return the number formed by concatenating the largest digit from ‘A’, ‘B’, and ‘C’.
You do not need to print anything; it has already been taken care of. Just implement the function.
1 <= T <= 10^4
1 <= A, B, C <= 10^6
Time limit: 1 Sec
A simple and efficient approach is to find all the digits of the given number and find the largest digit from them. For a number ‘x’, the digit at units place is equal to ‘x%10’ (‘%’ gives the division’s remainder). If we divide ‘x’ by ‘10’, each digit of ‘x’ will be shifted to the right, and the digit at the hundreds place will be shifted to units place. Now ‘x%10’ will give the digit at the hundreds place in the original ‘x’. So, keep dividing ‘x’ by ‘10’ until ‘x’ becomes ‘0’ to find all the digits of ‘x’.
The ‘largestDigit(integer x)’ function. Used to find the largest digit in ‘x’:
Similarly, to concatenate a digit to ‘x’, multiply ‘x’ by ‘10’ and add the digit to the new value of ‘x’. Use ‘largestDigit’ to find the largest digit in ‘A’, ‘B’, ‘C’ and concatenate it to ‘res’.
Pair Product Div by K
Pair Product Div by K
Merge Two Sorted Arrays Without Extra Space
Merge Two Sorted Arrays Without Extra Space
Co-Prime
First Digit One
Special Digit Numbers