> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0088_merge_sorted_array/slt.md).

# 思路1 归并排序

* 时间复杂度 $O(m + n)$
* 空间复杂度 $O(1)$

这道题需要在nums1里就地归并，为了避免覆盖nums1的元素，我们从后往前进行归并。

另外结果本来就要存在nums1中，所以最后只用检查nums2有没有走完，nums1不用检查。
