Submission Detail

113 / 113 test cases passed.
Status:

Accepted

Runtime: 25 ms
Memory Usage: 42.3 MB
Submitted: 5 days, 2 hours ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0
75
80
85
90
95
100
105
110
java
Runtime (ms)
Distribution (%)

0
1
2
3
4
5
6
7
8
9
10
80
90
100
110
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

40800
40100
40200
40300
40400
40500
40600
40700
40900
41000
41100
41200
41300
41400
41500
5
10
15
20
java
Memory (KB)
Distribution (%)

40800
40100
40200
40300
40400
40500
40600
40700
40900
41000
41100
41200
41300
41400
41500
5
10
15
20
Zoom area by dragging across this chart

Invite friends to challenge Remove Element


Submitted Code: 5 days, 2 hours ago

Language: java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Solution {
public int removeElement(int[] nums, int val) {
int k = nums.length;
for (int i = 0; i < k; i++) {
System.out.println("i = " + i);
if (nums[i] == val) {
for (int j = i+1; j < nums.length; j++) {
nums[j-1] = nums[j];
}
i--;
k--;
System.out.println("k = " + k);
for (int v = 0; v < k; v++)
System.out.print(nums[v] + " ");
System.out.println("\n");
}
}
return k;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX