Professional Documents
Culture Documents
3. We'll say that a number is "teen" if it is in the range 13..19 inclusive. Given 3 int
values, return true if 1 or more of them are teen.
4. Given two non-negative int values, return true if they have the same last digit,
such as with 27 and 57.
5. Given two int values, return their sum. Unless the two values are the same, then
return double their sum.
sumDouble(1, 2) ? 3
sumDouble(3, 2) ? 5
sumDouble(2, 2) ? 8
6. 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.
7. Once Mary heard a famous song, and a line from it stuck in her head. That line
was "Will you still love me when I'm no longer young and beautiful?". Mary
believes that a person is loved if and only if he/she is both young and beautiful, but
this is quite a depressing thought, so she wants to put her belief to the test.
Knowing whether a person is young, beautiful and loved, find out if they contradict
Mary's belief.
A person contradicts Mary's belief if one of the following statements is true:
they are young and beautiful but not loved;
they are loved but not young or not beautiful.
Example
For young = true, beautiful = true and loved = true, the output should be
willYou(young, beautiful, loved) = false.
Young and beautiful people are loved according to Mary's belief.
For young = true, beautiful = false and loved = true, the output should be
willYou(young, beautiful, loved) = true.