Given an unsorted integer array, find the first missing positive integer.
For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses constant space.
For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses constant space.
本文介绍了一种在未排序整数数组中查找首个缺失正整数的算法。例如,对于数组[1,2,0]返回3,对于[3,4,-1,1]返回2。该算法能在O(n)时间内运行并使用常量空间。
274

被折叠的 条评论
为什么被折叠?



