iOS 11 has a bug that makes the result of 1+2+3 to be 24. This is related to the animation speed, but anyway:
The task is to make 1 + 2 + 3 == 24
. But only that. So you should provide a function that correctly sums most sequences but returns 24
when the arguments are 1
, 2
and 3
in any order.
Example inputs:
1 2 => 3
3 4 => 7
1 2 3 4 5 6 7 8 9 => 45
3 2 1 => 24
2 1 3 => 24
1 1 => 2
1 2 3 => 24
40 2 => 42
1 2 2 4 => 9
1 2 3 4 1 2 3 => 16
1 => 1
1 23 => 24
0 1 2 => 3
3 2 3 => 8
Input can be in any format as long as your code accepts any number of arguments.
- Support for negative numbers isn't required (all non negative numbers are required to work, that includes 0)
- We assume correct input
Differences from another similar question: "What do you get when you multiply 6 by 9? (42)":
- In this case your function is required to accept any number of arguments. The old question specifies exactly 2.
- In this case order doesn't matter, while the old question specified that order
6 9
is required and9 6
should be evaluated correctly.