VB.NET Array Intersection

后端 未结 4 940
无人及你
无人及你 2021-01-07 00:31

This could be terribly trivial, but I\'m having trouble finding an answer that executes in less than n^2 time. Let\'s say I have two string arrays and I want to know which s

4条回答
  •  半阙折子戏
    2021-01-07 01:28

    If one of the arrays is sorted you can do a binary search on it in the inner loop, this will decrease the time to O(n log n)

提交回复
热议问题