541.Find the Smallest of Three Numbers
Easy
Given three integers
a, b and c, return the smallest of them.
The ternary operatorTernary Operatorcondition ? valueIfTrue : valueIfFalse — an if-else that produces a value and fits inside an expression. is a compact if-else that produces a value. Because a ternary is itself a value, one can sit inside another, and two nested ternaries are enough for three numbers. The if-else version is shown first, so the two can be compared directly.
Example 1:
Input: a = 8, b = 2, c = 6
Output: 2
Example 2:
Input: a = 5, b = 5, c = 5
Output: 5
+ 6 hidden test cases run on Submit.
Constraints:
- ●
-1000000 ≤ a, b, c ≤ 1000000
a =
8
b =
2
c =
6