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
'알고리즘 > LeetCode' 카테고리의 다른 글
[LeetCode/easy/Array] Pascal's triangle II (0) | 2022.08.16 |
---|---|
[LeetCode/easy/Array] Pascal's triangle (0) | 2022.08.16 |
[LeetCode/easy/Array] Plus One (0) | 2022.08.16 |
[LeetCode/easy/Array] Search Insert Position (0) | 2022.08.16 |
[LeetCode/easy/Array] Remove Element (0) | 2022.08.16 |