Hackerearth Roses in a Shop

I tried understanding the editorial but i am not able to get it ,I also read an article on gfg related to this still i am confused . Can anyone explain how to solve this ?

Problem

Try it with after doing some problems on prefix and suffix sum .Then you will easily be able to solve this question . :wink: :wink:

1 Like

Thanks ,I will try problems on this topic .