There was one kind of question which I really liked and I thought to share those.

We had to give the shortest way to express following 5 things in function of min(a,b) , max (a,b) (which return respectively the minimum and the maximum of the 2 given parameters) ,+,-,/ and *.

1. The greatest of 3 numbers a b and c

2. The absolute value of any number a.

3. The difference between a and the one closest to a. (a b and c as inputs)

4. If a<b: return 0 ; else return b (a and b are positive and a is not b)

5. same as 4. but a and b are integers. (note that for integers 3/5 is not 0.6 but 0 and a remainder of 3). This one should be shorter than the solution of 4.

5 was the only question I didn't answer correctly. Can you find the solutions to all 5?

]]>