알고리즘/LeetCode

[LeetCode/easy/Array] Merge Sorted Array

녕이 2022. 8. 16. 17:07
728x90

 

 

https://leetcode.com/problems/merge-sorted-array/

 

Merge Sorted Array - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

 

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

 

 

 

728x90