I used QuickSelect and with a random shuffle and runs in 10ms.
However, the runtime is only 3ms using Arrays.sort().
Anyone can tell me why?
Simply because the QuickSelect is written by you, but the Array's Quick Sort is rewritten and optimized by supper brilliant and experienced engineers for hundred of times.
@zhongpei Show us the code please, which could enable us further understand your problem.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.