Two pointer in cyclic array : help

Правка en2, от 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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Bhanuvenkat 2024-04-24 12:04:46 55
en1 Английский Bhanuvenkat 2024-04-24 12:03:03 332 Initial revision (published)