Leetcode 75
class Solution {
public:
string mergeAlternately(string word1, string word2) {
string res;
int k = 0;
for(int i = 0; i < word1.size(); i++) {
res.push_back(word1[i]);
if(k < word2.size()) res.push_back(word2[k++]);
}
for(; k < word2.size(); k++) {
res.push_back(word2[k]);
}
return res;
}
};Reverse Vowels - 479/480 :)
643. Maximum Average Subarray I - 115 / 127 test cases passed
Last updated
Was this helpful?
