Problem title
Difficulty
Avg time to solve

Count Pairs
Easy
--
Rotate Array ll
Moderate
--
Pattern Printing
Easy
10 mins
Maximum AND Sum of Array
Hard
--
Ninja And Matrix
Easy
15 mins
Ninja In Interview
Easy
15 mins
Change Case
Easy
--
Can You Print
Easy
12 mins
Bucket Sort
Moderate
15 mins
Detect Odd
Moderate
25 mins

Minimum And Maximum

Difficulty: EASY
Contributed By
Avg. time to solve
15 min
Success Rate
85%

Problem Statement

You have been given two integers 'A' and 'B' return minimum and maximum of both the numbers without branching.

Note :
Branching includes if-else statements, the ternary operator, or switch-case statements. Therefore you should not use any of the above approaches to solving the problem.
Input Format :
The first line contains a single integer ‘T’ representing the number of test cases.

The only line of each test case contains two space-separated integers 'A' and 'B' representing two integers whose minimum and the maximum you need to return.
Output Format :
For each test case return the minimum and maximum of two numbers.
Note:
You do not need to print anything; it has already been taken care of. Just implement the function.
Constraints :
1 <= T <= 1000
1 <= 'A' <= 10^9
1 <= 'B' <= 10^9

Time Limit: 1sec
Sample Input 1 :
4
1 1
2 1
17 13
11 24
Sample Output 1 :
1 1
1 2
13 17
11 24
Explanation For Sample Input 1:
Test case 1 : 

1 is the minimum of the two numbers.1 is the maximum of the two numbers. Therefore the answer is 1 1.

Test case 2 :

1 is the minimum of the two numbers.2 is the maximum of the two numbers. Therefore the answer is 1 2.

Test case 3 :

13 is the minimum of the two numbers.17 is the maximum of the two numbers. Therefore the answer is 13 17.

Test case 4 :

11 is the minimum of the two numbers.24 is the maximum of the two numbers. Therefore the answer is 11 24.
Sample Input 2 :
2
15 20
4 3
Sample Output 2 :
15 20
3 4
Reset Code
Full screen
copy-code
Console