Open unliar opened 3 years ago
const findKthLargest = (nums, k) => {
const ns =[...nums];
let n =0;
while(n < k){
n++;
const maxIndex = GetMaxIndex(ns)
if (n == k) {
return ns[maxIndex];
}
ns.splice(maxIndex,1) // 删除
}
};