请教一个问题的答案,好像以前有人讨论过# JobHunting - 待字闺中
K*g
1 楼
You have an array A of unknown length L. The array contains numbers that
are distinct and sorted ascendingly. The array is 1-indexed i.e. first
element is got by A[1] and not A[0]. To help u, since L is not known, when
an index out of bounds is used, then a special value of NOT_FOUND is
returned. The question is to find some positive integer n such that when
used as the index, the result from the array is the n itself. i.e. A[n] = n.
are distinct and sorted ascendingly. The array is 1-indexed i.e. first
element is got by A[1] and not A[0]. To help u, since L is not known, when
an index out of bounds is used, then a special value of NOT_FOUND is
returned. The question is to find some positive integer n such that when
used as the index, the result from the array is the n itself. i.e. A[n] = n.