Two sum problem

sir , like if use first method mention in this video that is :-

for(i=0;I<n;i++){
for(j=i+1;I<n;i++){
if(a[I]+a[j]==sum)
cout<<" ith and jth "

for this I wanted to know what is space complexity is it 0(n). because of that we consider two pointer method better??

space is occupied by only array used…

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.