← All problemsSign in

Plus Minus Sequence

Chef has an array of $N$ integers and $Q$ queries. In each query Chef will be given $L$ and $R$. Chef has to apply alternative $+$,$-$, starting from a $+$ in range $L$ to $R$. For example if range contains following elements $2,3,4$ so answer should be $+2-3+4$ i.e $3$ . Chef asks you to help him so that he can continue playing his favorite game ###Input: - First line will contain $N$ -

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start