Practice/Meta/Leetcode 1985. Find the Kth Largest Integer in the Array
CodingMust
You are given an array of strings where each string represents a non-negative integer. These integers may be extremely large and cannot fit into standard integer data types. Your task is to identify and return the k-th largest number from this array when sorted in descending order by their numeric values.
Note that duplicate values are considered as separate entries. For instance, if the array contains two instances of "100", they occupy two distinct positions in the sorted order.
Example 1:
Input: nums = ["3", "6", "7", "10"], k = 4 Output: "3" Explanation: When sorted in descending order by numeric value: ["10", "7", "6", "3"] The 4th largest is "3".
Example 2:
Input: nums = ["2", "21", "12", "1"], k = 3 Output: "2" Explanation: Sorted descending: ["21", "12", "2", "1"] The 3rd largest is "2".
Example 3:
Input: nums = ["100", "100", "50"], k = 2 Output: "100" Explanation: The two "100" values are treated as separate entries. Sorted: ["100", "100", "50"] The 2nd largest is "100".