Re: [閒聊] 每日LeetCode已回收

看板Marginalman作者 (動物園 公告)時間2年前 (2023/12/01 09:52), 編輯推噓1(102)
留言3則, 2人參與, 2年前最新討論串560/719 (看更多)
1662. Check If Two String Arrays are Equivalent 給你兩個字串陣列 回傳兩個陣列是否表示相同字串 把陣列元素按順序連接在一起之後就是他的字串 Input: word1 = ["ab", "c"], word2 = ["a", "bc"] Output: true word1: "ab" + "c" -> "abc" word2: "a" + "bc" -> "abc" Input: word1 = ["a", "cb"], word2 = ["ab", "c"] Output: false Input: word1 = ["abc", "d", "defg"], word2 = ["abcddefg"] Output: true Approach: 用join合併之後直接比較 TS Code: function arrayStringsAreEqual (word1: string[], word2: string[]): boolean { return word1.join('') === word2.join('') } -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.32.229.33 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1701395564.A.409.html

12/01 09:56, 2年前 , 1F
這題送分題
12/01 09:56, 1F

12/01 10:20, 2年前 , 2F
這是不是想考字串比較的function 實作
12/01 10:20, 2F

12/01 10:31, 2年前 , 3F
不清楚 他難度只有easy
12/01 10:31, 3F
文章代碼(AID): #1bQJniG9 (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1bQJniG9 (Marginalman)