The problem code-
I am stuck after this point ,please help with this
My code-
The problem code-
I am stuck after this point ,please help with this
My code-
Tell me about the logic you are using, will help that accordingly.
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.
I want to first sort the array then checkout whether the difference between 2 consequetive nos integers in the array is0,if its so then then there’s no missing positive ,otherwise find that
int arr[n];
cin>>n;
sort(arr,arr+n);
for(int i=0;i<n;i++)
if(arr[i+1]-arr[i]!=0):
break;
what you are doing here??
in this question you only have to implement the function
don’t bother about input
all the necessary things are provided in parameter of function
here in the function you have vector& nums
vector of integers
you can also find size using nums.size();
yes that’s okay
you can do that
also remember that
difference should be 1 not 0
and also consider these cases
[-1 0 1 2 3 4]
[7 8 9 10]
Is there any better approach for this with less time complexity ??