This lesson, about extra practice with the min and max functions, is optional. If you get stuck on a problem, feel free to skip to the next problem and come back later.
Simplifying a complex expression
Multiple Choice Exercise: Simplification
What is a simplification of the following expression?
max(x - 3, min(x + 10, x + 5))
Correct! Since
x + 5 is always smaller than x + 10, we can simplify min(x + 10, x + 5) to just x + 5. Then working our way outwards, the entire expression is max(x - 3, x + 5). Since x + 5 is always the maximum of these two numbers, that is the result.Complicating a simple expression
Payment Calculator
Sorting Scramble
The final problem is a challenging problem, about sorting numbers in a weird way. There are better, simpler, and faster sorting methods that you can learn about after completing our introductory lessons.
Continue on to lesson 3!

