How to tell if an array is a permutation in O(n)?

后端 未结 16 1684
粉色の甜心
粉色の甜心 2020-12-07 10:17

Input: A read-only array of N elements containing integer values from 1 to N (some integer values can appear more than once!). And a memory zone of a fixed<

16条回答
  •  感动是毒
    2020-12-07 10:32

    it looks like asking to find duplicate in array with stack machine.

    it sounds impossible to know the full history of the stack , while you extract each number and have limited knowledge of the numbers that were taken out.

提交回复
热议问题