Submission Detail

59 / 59 test cases passed.
Status:

Accepted

Runtime: 20 ms
Memory Usage: 42.1 MB
Submitted: 4 days, 22 hours ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

0
1
2
3
4
5
6
7
8
9
10
11
30
40
50
60
70
80
java
Runtime (ms)
Distribution (%)

0
1
2
3
4
5
6
7
8
9
10
11
40
60
80
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

40500
40750
41000
41250
41500
41750
42000
42250
42500
42750
2
4
6
8
10
java
You are here!
Your memory usage beats 56.94 % of java submissions.
Memory (KB)
Distribution (%)

40500
40750
41000
41250
41500
41750
42000
42250
42500
42750
5
10
Zoom area by dragging across this chart

Invite friends to challenge Merge Sorted Array


Submitted Code: 4 days, 22 hours ago

Language: java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class Solution {
public void merge(int[] nums1, int m, int[] nums2, int n) {
int[] merged = new int[m+n];
int i = 0;
int j = 0;
int ind = 0;
while (i < m && j < n) {
if (nums1[i] <= nums2[j]) {
merged[ind++] = nums1[i++];
System.out.println(merged[ind-1]);
} else {
merged[ind++] = nums2[j++];
System.out.println(merged[ind-1]);
}
}
while (i < m) {
merged[ind++] = nums1[i++];
}
while (j < n) {
merged[ind++] = nums2[j++];
}
for (int k = 0; k < merged.length; k++) {
nums1[k] = merged[k];
System.out.print(merged[k] + " ");
}
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX