Two pointer in cyclic array : help

Revision en2, by Bhanuvenkat, 2024-04-24 12:04:46

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]);

     }

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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Bhanuvenkat 2024-04-24 12:04:46 55
en1 English Bhanuvenkat 2024-04-24 12:03:03 332 Initial revision (published)