csharp LeetCode Uncommon Words from Two Sentences 亂寫於 2021-02-17 更新於 2025-02-19 Disqus: 廢話字數: 309 所需傷眼時間 ≈ 1 分鐘 這題用 linq 寫了半天 , 一開始想得太過複雜 , 後來發現只要先把兩個字串進行連結 , 接著找出只出現一次的就搞定了 12345678910public class Solution { public string[] UncommonFromSentences(string A, string B) { return string.Concat(A, " ", B) .Split( ) .GroupBy( x => x ) .Where( x => x.Count( ) == 1 ) .Select( x => x.Key ) .ToArray( ); }}