Selection and partitioning: Return the kth largest value in nums where k is one-based, or null when k is outside the valid range.
Input: A JSON object { "nums": number[], "k": number }.
Output: A JSON number or null.
Constraints:
- 0 <= nums.length <= 100000
- Values may repeat
- Aim for expected linear time rather than fully sorting
Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.
Difficulty: MEDIUM. Variant: 2. Expect follow-up questions about complexity, edge cases, and alternative approaches.
Practice context
This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked medium difficulty.
The signed-in workspace provides the tools required by the round, such as recording, code execution, diagrams, structured notes, or