/**
* @param {number[]} nums1
* @param {number} m
* @param {number[]} nums2
* @param {number} n
* @return {void} Do not return anything, modify nums1 in-place instead.
*/
var merge = function (nums1, m, nums2, n) {
nums1.splice(m);
nums1.push(...nums2);
return nums1.sort((a, b) => a - b);
};
GitHub : https://github.com/developeSHG/Algorithm-LeetCode/tree/main/merge-sorted-array
'Coding Test > LeetCode' 카테고리의 다른 글
[LeetCode] (Dynamic Programming) Lv Easy. Climbing Stairs (0) | 2023.01.22 |
---|---|
[LeetCode] (Sorting and Searching) Lv Easy. First Bad Version (0) | 2023.01.22 |
[LeetCode] (Trees) Lv Easy. Maximum Depth of Binary Tree (0) | 2023.01.21 |
[LeetCode] (Linked List) Lv Easy. Delete Node in a Linked List (0) | 2023.01.16 |
[LeetCode] (Strings) Lv Easy. Reverse Integer (0) | 2023.01.16 |
댓글