TLE
AC, with sort list approach much simpler