I apply two pointers technique as↵
↵
↵
↵
int j=0;↵
↵
for(int i=0;i<n;i++){↵
↵
add(a[i]);↵
↵
while(!func(sum)){↵
j++;↵
sub(a[j]);↵
}↵
j++;↵
↵
sub(a[j]);↵
↵
}↵
↵
ans+= max(something) // or any thing needed in quesiton↵
↵
}↵
↵
I want to apply this on cyclic array can anyone modify the code so that it can be applied on cyclic array
↵
↵
↵
int j=0;↵
↵
for(int i=0;i<n;i++){↵
↵
add(a[i]);↵
↵
while(!func(sum)){↵
sub(a[j]);↵
}
j++;↵
↵
sub(a[j]);↵
↵
}↵
↵
ans+= max(something) // or any thing needed in quesiton↵
↵
}↵
↵
I want to apply this on cyclic array can anyone modify the code so that it can be applied on cyclic array