I need to "Find the minimal positive integer not occurring in a given sequence. "
A[0] = 1
A[1] = 3
A[2] = 6
A[3] = 4
A[4] = 1
A[5] = 2, the function should return 5.
Assume that:
N is an integer within the range [1..100,000];
each element of array A is an integer within the range [?2,147,483,648..2,147,483,647].
Run Code Online (Sandbox Code Playgroud)
我在代码中编写了代码,但在许多情况下它没有用,性能测试给出了0%.请帮帮我,我错了.
class Solution {
public int solution(int[] A) {
if(A.Length ==0) return -1;
int value = A[0];
int min = …Run Code Online (Sandbox Code Playgroud)