Re: [闲聊] 每日LeetCode

楼主: Rushia (みけねこ的鼻屎)   2022-10-25 09:18:52
1662. Check If Two String Arrays are Equivalent
给予两个字串阵列判断它们拼接起来之后是否相等。
Example:
Input: word1 = ["ab", "c"], word2 = ["a", "bc"]
Output: true
Explanation:
word1 represents string "ab" + "c" -> "abc"
word2 represents string "a" + "bc" -> "abc"
The strings are the same, so return true.
思路:
1.拼接起来判断是否相等。
JavaCode:
class Solution {
public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
StringBuilder s1 = new StringBuilder();
StringBuilder s2 = new StringBuilder();
for(String w : word1)
s1.append(w);
for(String w : word2)
s2.append(w);
return s1.toString().equals(s2.toString());
}
}
靠北 这啥白痴题
https://i.imgur.com/HLS8By9.gif
作者: Jaka (Jaka)   2022-10-25 09:19:00
大师
作者: ken890126 (靈魂奸商 路西法)   2022-10-25 09:22:00
答案是C
作者: twosheep0603 (两羊)   2022-10-25 09:38:00
就这?
作者: koy784512 (我永远喜欢风真いろは)   2022-10-25 09:53:00
大师

Links booklink

Contact Us: admin [ a t ] ucptt.com