4ms c++ solution


  • -1
    M

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


  • 0
    N

    I don't think using 'sort' is good.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.