Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort <code>nums</code> in non-descending order.
For all the smaller values on the left side of the median, change them to <code>k</code> if they are larger than <code>k</code>.
For all the larger values on the right side of the median, change them to <code>k</code> if they are smaller than <code>k</code>.