Ayush7614 / Ayush7614/Daily-Coding-DS-ALGO-Practice
Merge two sorted arrays
- Dominant language
- C++
- Stars
- 323
- Forks
- 472
- PR merge metrics
- No merged PRs in 30d
Description
# Aim
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 this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored. nums2 has a length of n.
# Details
This is a problem from leetcode. I would like to add a solution to this.
### Programming language
- [ ] C
- [x] C++
- [ ] Java
- [ ] Python
Contributor guide
Research direction
No file, test, or entry point is named. Start by locating the repository’s existing C++ solution layout and the entry point for this problem; implement the stated in-place merge behavior, then verify that nums1 contains the combined non-decreasing sequence for the described m and n inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100