欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

88. 合并两个有序数组

程序员文章站 2024-02-24 23:46:46
...
88. 合并两个有序数组

4 ms:

class Solution {
public:
    void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
        
        int i =m;
        int j=0;
        while(j<n)
        {
            nums1[i]=nums2[j];
            i++;j++;
        }
        sort(nums1.begin(),nums1.end());
    }
};