Confused on this question

That’s right: the maximum difference is 5, where the larger element is 6 and the smaller number is 1. Notice how it says larger and smaller, not largest nor smallest (i.e., it’s relative, not absolute). If it said largest, then yeah, 9 is the largest element and the max difference would be 2, but it doesn’t say that. The only condition is that the bigger number between the 2 from which you are taking the difference comes after the smaller one, i.e., arr = []int{7, 9, 1, 3, 2, 6} should return 5 too, while []int{7, 9, 6, 3, 2, 1} should return 2.