Find the only unique element in an array of a million elements

前端 未结 4 618
余生分开走
余生分开走 2021-01-04 09:46

I was asked this question in a recent interview.

You are given an array that has a million elements. All the elements are duplicates except one. My task is to find t

4条回答
  •  粉色の甜心
    2021-01-04 10:21

    Your approach seems fine. It could be that he was looking for an edge-case where the array is of even size, meaning there is either no unmatched elements or there are two or more. He just went about asking it the wrong way.

提交回复
热议问题