Skip to content

Commit f89ee0e

Browse files
authored
Create 1985-find-the-kth-largest-integer-in-the-array.js
1 parent 29ab25a commit f89ee0e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @param {string[]} nums
3+
* @param {number} k
4+
* @return {string}
5+
*/
6+
const kthLargestNumber = function(nums, k) {
7+
nums.sort((a, b) => BigInt(b) - BigInt(a) === 0n ? 0 : (BigInt(b) - BigInt(a) > 0n ? 1 : -1) )
8+
return nums[k - 1]
9+
};

0 commit comments

Comments
 (0)