Submission Detail

108 / 108 test cases passed.
Status:

Accepted

Runtime: 7 ms
Memory Usage: 42.1 MB
Submitted: 0 minutes ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

0
2
4
6
8
10
12
14
16
10
20
30
40
java
You are here!
Your runtime beats 29.47 % of java submissions.
Runtime (ms)
Distribution (%)

0
2
4
6
8
10
12
14
16
10
20
30
40
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

39500
39750
40000
40250
40500
40750
41000
41250
41500
41750
42000
2.5
5.0
7.5
10.0
12.5
java
You are here!
Your memory usage beats 13.87 % of java submissions.
Memory (KB)
Distribution (%)

39500
39750
40000
40250
40500
40750
41000
41250
41500
41750
42000
5
10
Zoom area by dragging across this chart

Invite friends to challenge Merge Strings Alternately


Submitted Code: 0 minutes 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
class Solution {
public String mergeAlternately(String word1, String word2) {
String mergedWord = "";
int len = 0;
if (word1.length() < word2.length())
len = word1.length();
else
len = word2.length();
for (int i = 0; i < len; i++) {
mergedWord += word1.charAt(i);
mergedWord += word2.charAt(i);
}
if (word1.length() < word2.length())
for (int i = len; i < word2.length(); i++)
mergedWord += word2.charAt(i);
else
for (int i = len; i < word1.length(); i++)
mergedWord += word1.charAt(i);
return mergedWord;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX