A phone interview problem about algorithm# JobHunting - 待字闺中
V*i
1 楼
I cannot figure it out till now. Looking for help.
Given an array of integers with duplication, write a function to determine
whether this array is a sequence. A sequence is defined as every integer
between min and max is present. For example, {2, 3, 2, 5, 7, 7, 6, 4, 2} is
a sequence. But {2, 3, 5, 3} is not.
Write a program with O(n) time complexity, and O(1) space. The array CAN BE
DESTROYED.
Given an array of integers with duplication, write a function to determine
whether this array is a sequence. A sequence is defined as every integer
between min and max is present. For example, {2, 3, 2, 5, 7, 7, 6, 4, 2} is
a sequence. But {2, 3, 5, 3} is not.
Write a program with O(n) time complexity, and O(1) space. The array CAN BE
DESTROYED.