c++19 88. Merge Sorted Array c++ 문제 88. Merge Sorted Array You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order. The final sorted array should not be returned by the function, but instead be stored inside the array nums1. To accommodate .. 2022. 6. 20. 75. Sort Colors LeetCode C++ https://leetcode.com/problems/sort-colors/description/ Sort Colors - 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 Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, .. 2022. 6. 20. LeetCode 283번 Move Zeroes Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. 정수 배열 번호가 주어지면 0이 아닌 요소의 상대적인 순서를 유지하면서 0을 모두 그 끝으로 이동합니다. 이 작업은 어레이의 복사본을 만들지 않고 인 플레이스에서 수행해야 합니다. Example 1:예제 Input: nums = [0,1,0,3,12] Output: [1,3,12,0,0] Example 2: 예제 Input: nums = [0] Output: [0.. 2022. 6. 11. Binary search LeetCode-704 문제 Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You must write an algorithm with O(log n) runtime complexity. 오름차순으로 정렬된 정수 숫자의 배열과 정수 대상을 숫자로 검색하기 위한 함수를 작성합니다. 대상이 있으면 인덱스를 반환합니다. 그렇지 않으면 -1을 반환합니다. 런타임 복잡도가 O(log n)인 알고리즘을 작성해야 합니다. Example 1:예시 .. 2022. 6. 11. 이전 1 2 3 4 5 다음