Implementing an efficent algorithm to find the intersection of two strings

前端 未结 5 1928
挽巷
挽巷 2020-12-18 13:29

Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once.

5条回答
  •  太阳男子
    2020-12-18 13:57

    How about this ...

    var s1 = "aabbccccffffd";
    var s2 = "aabc";
    
    var ans = s1.Intersect(s2);
    

提交回复
热议问题