Find unique common element from 3 arrays

前端 未结 7 1599
故里飘歌
故里飘歌 2021-02-03 14:43

Original Problem:
I have 3 boxes each containing 200 coins, given that there is only one person who has made calls from all of the three boxes and thus the

7条回答
  •  爱一瞬间的悲伤
    2021-02-03 15:34

    If you sort all the arrays first O(n log n) then it will be pretty easy to find the common element in less than O(n^3) time. You can for example use binary search after sorting them.

提交回复
热议问题