알고리즘/codefights
11>extraNumber
Diademata
2018. 5. 19. 23:26
반응형
You're given three integers, a, b and c. It is guaranteed that two of these integers are equal to each other. What is the value of the third integer? Example For a = 2, b = 7 and c = 2, the output should be extraNumber(a, b, c) = 7. The two equal numbers are a and c. The third number (b) equals 7, which is the answer. |
code>>
int extraNumber(int a, int b, int c) {
return a == b ? c : a == c ? b : a;
}
반응형