leftover: better solution of less time complexity