last book exercise, finding max min etc