my c++ code in 3ms,very clear.


  • 0
    F

    class Solution {
    public:
    void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
    for(int i=m;i<m+n;i++)
    {
    nums1[i]=nums2[i-m];
    }

      sort(nums1.begin(),nums1.end());
    }
    

    };


Log in to reply
 

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