Another solution with sorting