Re: [闲聊] 每日LeetCode

楼主: Rushia (みけねこ的鼻屎)   2023-04-18 21:24:57
1768. Merge Strings Alternately
给你两个字串s1和s2,合并两个字串并使其交错。
Example:
Input: word1 = "abc", word2 = "pqr"
Output: "apbqcr"
Explanation: The merged string will be merged as so:
word1: a b c
word2: p q r
merged: a p b q c r
Example 2:
Input: word1 = "ab", word2 = "pqrs"
Output: "apbqrs"
Explanation: Notice that as word2 is longer, "rs" is appended to the end.
word1: a b
word2: p q r s
merged: a p b q r s
思路:
1.把两个字串按照顺序一个一个放到阵列,直到两个都放完为止。
Java Code:
作者: v03516020 (露露贝尔)   2023-04-18 21:26:00
大师
作者: pandix (面包屌)   2023-04-18 21:29:00
大师

Links booklink

Contact Us: admin [ a t ] ucptt.com