Cant understanf the logic

can you please guide me to correct solution and logic for this question

hi @vmayaan,
which question? alex one to I replied na you have given same link

maximum circular sum bhaiya @talhashamim001
i tried like explained in video https://ide.codingblocks.com/s/661445 but cant understand please guide

hi @vmayaan,

since it is a circular array we can understand it as 2 cases if max sum subarray is present normally or there is a wrap around condition.

So first unfold the array i.e make another array of size 2*n and repeat the array in that
eg if arr is [1,2,3] make brr as [1,2,3,1,2,3]
now this brr array is unfolded. Now try finding max sum subarray in every continuous window of size n (original)
here wrap around condition will also be covered
eg arr is [1,-50,10] then brr will be [1,-50,10,1,-50,10] so we will get [10,1] which is wrapped from last to start of array arr

for implementation refer https://ide.codingblocks.com/s/658419

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.