Concatenate the largest digit
You are given three non-zero numbers ‘A’, ‘B’, and ‘C’. The task is to find the number formed by concatenating the largest digit from each of these numbers in the order of ‘A’, ‘B’, and ‘C’.
For Example :
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’.
Input Format :
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.
Output Format :
For every test case, return the number formed by concatenating the largest digit from ‘A’, ‘B’, and ‘C’.
Note :
You do not need to print anything; it has already been taken care of. Just implement the function.
Constraints :
1 <= T <= 10^4
1 <= A, B, C <= 10^6
Time limit: 1 Sec
CodingNinjas
author
2y
Find All Digits
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’ (‘%’ gi...read more
Help your peers!
Add answer anonymously...
Top TAAZAA Associate Software Engineer interview questions & answers
Popular interview questions of Associate Software Engineer
Top HR questions asked in TAAZAA Associate Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app