Simply finding the max is enough for solving this problem, no need to do sorting, O(nlgn) => O(n).