Submission Detail

61 / 61 test cases passed.
Status:

Accepted

Runtime: 2 ms
Memory Usage: 55.4 MB
Submitted: 1 week, 4 days 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
12
13
14
15
10
20
30
40
50
60
java
You are here!
Your runtime beats 99.33 % of java submissions.
Runtime (ms)
Distribution (%)

0
2
4
6
8
10
12
14
25
50
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

50000
50500
51000
51500
52000
52500
53000
53500
54000
54500
55000
55500
2
4
6
8
10
java
You are here!
Your memory usage beats 31.52 % of java submissions.
Memory (KB)
Distribution (%)

50000
50500
51000
51500
52000
52500
53000
53500
54000
54500
55000
55500
5
10
Zoom area by dragging across this chart

Invite friends to challenge Container With Most Water


Submitted Code: 1 week, 4 days 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
class Solution {
public int maxArea(int[] height) {
if (height.length < 0) {
return 0;
}
int max = 0;
int cutoff = height.length-1;
if (height.length > (10*10*10*10*10))
cutoff = 10*10*10*10*10;
int left = 0;
int right = cutoff;
while (left < right) {
if (height[left] <= height[right]) {
if (height[left] * (right-left) > max) {
max = height[left] * (right-left);
}
left++;
} else {
if (height[right] * (right-left) > max) {
max = height[right] * (right-left);
}
right--;
}
}
return max;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX