Be the first user to complete this post
|Add to List|
Sort 3 Integers without using if condition OR use only Max() function.
Objective: - Given three integers, sort them without using if condition.
- Say 3 integers are, a, b, and c.
- Find the maximum of a, b, and c using Max() function.
- multiply all integers by -1. Again find Minimum of -a, -b, -c using Max() function.
- Add the Max and Min from the above steps and subtract them from (a+b+c). It will give you a middle element.
Sorted order 1 4 9