What I can understand is :
- first we need to add the elements in a circular fashion and then at the last iteration we need to x2 every elements?
Is it the case?
What I can understand is :
Hi @Riya-Verma-1207263756078812,
The question says you need to calculate the sum of array while shifting the elements equal to the given query
Each time u need to add the element with the element present at the place given in query in cyclic fashion from left i.e for first element u need to add from back
LOGIC :
u dont need to calculate the sum by shifting again and again, anyway u will be adding the array sum of that array only even if u shift and add as u r adding all the elements so dont shift just keep updating the sum of array
see here for implementation https://ide.codingblocks.com/s/657171
what’s the significance of mod… and how do you compute its value… can we write 10 on that place and not mod.
@Riya-Verma-1207263756078812,since the answer is large enough to store in variable so it says in question itself to take mod with the given no. so every time u do addition make sure to do mod so that it will remain in range.
Its value is given in question so u can’t change
In the solution, You didn’t used array, so how can we solve it using arrays