88

Programming/LeetCode

[Dart] 88. Merge Sorted Array

1. 문제 https://leetcode.com/problems/merge-sorted-array/description/?envType=study-plan-v2&envId=top-interview-150   2. 요구사항1) 배열 nums1과 nums2가 주어지며, num1은 충분한 공간을 할당받고 있다.2) num1의 초기 크기는 m이고, num2의 크기는 n이다.3) 두 배열을 합쳐 nums1에 정렬된 형태로 저장해야한다.  3. 핵심 아이디어  1) 뒤에서부터 채우고 정렬nums1의 유효 인덱스 다음부터 nums2 배열을 삽입한다. 그 후, nums1과 nums2가 합친 배열이 nums1에 저장되는데 이를 sort로 정렬한다.  2) 코드class Solution { void merge(List ..

Meezzi
'88' 태그의 글 목록