Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
21 lines (20 loc) · 517 Bytes

File metadata and controls

21 lines (20 loc) · 517 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class Solution {
public:
void merge(int A[], int m, int B[], int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int end = m + n - 1;
m -= 1;
n -= 1;
while (m >= 0 && n >= 0) {
if (A[m] > B[n])
A[end--] = A[m--];
else
A[end--] = B[n--];
}
while (m >= 0)
A[end--] = A[m--];
while (n >= 0)
A[end--] = B[n--];
}
};
Morty Proxy This is a proxified and sanitized view of the page, visit original site.