carsonSgit / leetcode

leetcode grind... doing whatever I can to make sure I'm not bad at CS.
4 stars 0 forks source link

Q1768 Solution #5

Closed carsonSgit closed 3 months ago

carsonSgit commented 3 months ago

What is this problem

You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the end of the merged string.

Return the merged string.

How do I solve it

Breakdown:

  1. Create a StringBuilder.
  2. Alternatively append character by character of the two param words.