nums1 has length m + n: its first m elements are sorted and the last n are placeholders. Merge the sorted list nums2 (length n) into nums1 in place so nums1 is fully sorted.
Fill from the back so you never overwrite values you still need.