As reported: Visa Staff Software Engineer, first round with a second team (2026): the k-th smallest element, reversing a linked list except its head and tail, and Spring / Java questions.
Given an integer array nums and an integer k, return the k-th smallest value in the array (in sorted order, counting duplicates; k = 1 is the minimum).
This is the mirror image of LeetCode 215 — Kth Largest Element in an Array: the k-th smallest is the (n − k + 1)-th largest.
Example
nums = [3,2,1,5,6,4], k = 2 -> 2
nums = [3,2,3,1,2,4,5,5,6], k = 4 -> 3
Constraints: 1 ≤ k ≤ nums.length ≤ 10^5; -10^4 ≤ nums[i] ≤ 10^4.
Code runner format: one JSON value per line: nums, then k. Implement kthSmallest(nums, k); the harness prints the value.