Find the unique mapping between elements of two same size arrays

后端 未结 3 1368
南旧
南旧 2021-02-05 20:21

I was recently asked this question in an interview:

There are two arrays of size \'n\' each. One array has nuts, the other one has bolts. Each nut fits exactly one bolt

3条回答
  •  面向向阳花
    2021-02-05 20:35

    For formal analyses (including quicksort) see http://www.wisdom.weizmann.ac.il/~naor/PUZZLES/nuts_solution.html and http://compgeom.cs.uiuc.edu/~jeffe/teaching/algorithms/notes/05-nutsbolts.pdf

提交回复
热议问题