Select a Ranked Large Decimal Integer. Each entry of nums is a nonnegative decimal integer written without leading zeros. Return the string representing the k-th largest entry, counting duplicate entries as separate ranks. Values may be too long for machine integer types.
### Problem
Each entry in `nums` is a nonnegative integer represented as a decimal string without leading zeros. Return the representation of the `k`-th largest entry. Duplicate entries occupy separate ranks, and representations may be too long for a machine integer.
```cpp
class Solution {
public:
string kthLargestNumber(vector<string>& nums, int k);
};
```
### Examples
**Example 1:**
```text
nums = ["9","100","22","22"], k = 3
Output: "22"
Explanation: Descending order is 100,22,22,9.
```
**Example 2:**
```text
nums = ["7","0","45"], k = 2
Output: "7"
Explanation: 45 is larger and 0 is smaller.
```
### Constraints
- `1 <= k <= nums.length <= 10^4`.
- Each string has 1 to 100 decimal digits and no leading zeros.
### Clarifying Questions
The single digit zero is valid. Do not deduplicate before selecting a rank.
```hint Inspect the structure
How do string length and lexicographic order combine into numerical order?
```
### Reasoning checkpoints
- Order entries by numerical value across the full permitted string length, without losing precision.
- Preserve duplicate multiplicity and handle valid representations of zero when selecting the requested rank.
### Optional extensions
How could you find the rank in a stream without retaining every entry?
Overview: Select a Ranked Large Decimal Integer. Each entry of nums is a nonnegative decimal integer written without leading zeros. Return the string representing the k-th largest entry, counting duplicate entries as separate ranks. Values may be too long for machine integer types.
Each entry in nums is a nonnegative integer represented as a decimal string without leading zeros. Return the representation of the k-th largest entry. Duplicate entries occupy separate ranks, and representations may be too long for a machine integer.
class Solution {
public:
string kthLargestNumber(vector<string>& nums, int k);
};
Examples
Example 1:
nums = ["9","100","22","22"], k = 3
Output: "22"
Explanation: Descending order is 100,22,22,9.
Example 2:
nums = ["7","0","45"], k = 2
Output: "7"
Explanation: 45 is larger and 0 is smaller.
Constraints
1 <= k <= nums.length <= 10^4
.
Each string has 1 to 100 decimal digits and no leading zeros.
Clarifying Questions Guidance
The single digit zero is valid. Do not deduplicate before selecting a rank.
Reasoning checkpoints
Order entries by numerical value across the full permitted string length, without losing precision.
Preserve duplicate multiplicity and handle valid representations of zero when selecting the requested rank.
Optional extensions
How could you find the rank in a stream without retaining every entry?