Missing Two Numbers : Is my code valid according to the given constraints?

package arrays;

public class ImpQuestion1 {

public static void main(String[] args) {
	int arr[] =  {1,3,4,6}; 
  MissingTwoElements(arr);
}
public static void MissingTwoElements(int [] arr )
{
	int n = arr.length;
	int brr[] = new int[n+2];
	for(int j=0;j<n+2;j++)
	{
		brr[j] = j+1;
	}
	int i=0 , count = 0 , low = 0 ; 
	while (i<n&&count<2)
	{
		if(arr[i]==brr[low]) {
			low++;
		}
		else
		{
			count++;
			System.out.println(brr[low]);
			low++;
			i--;
		}
		i++;
	}
}

}

Are the space and time complexities being fulfilled here ?

No,
when you create array br you actually take up space but the constraint is to do that in unit space O(1)… So your code is incorrect .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.