Submission Detail

1017 / 1017 test cases passed.
Status:

Accepted

Runtime: 45 ms
Memory Usage: 40.1 MB
Submitted: 1 minute ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

0
10
20
30
40
50
60
70
80
90
20
40
60
80
java
You are here!
Your runtime beats 8.54 % of java submissions.
Runtime (ms)
Distribution (%)

0
10
20
30
40
50
60
70
80
90
50
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

38600
38800
39000
39200
39400
39600
39800
40000
40200
40400
5
10
15
java
You are here!
Your memory usage beats 27.79 % of java submissions.
Memory (KB)
Distribution (%)

38600
38800
39000
39200
39400
39600
39800
40000
40200
40400
5
10
15
Zoom area by dragging across this chart

Invite friends to challenge Sqrt(x)


Submitted Code: 1 minute 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 mySqrt(int x) {
if (x == 1)
return 1;
int answer = 0;
int i = 1;
while (true) {
long square = i * i;
if (square <= x && square > 0) {
answer = i;
i++;
} else {
break;
}
}
return answer;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX