Exercise 2 - implement isSorted