← All problemsSign in

Alex and Cells

Its the first day of office for Alex as a prison officer. We have N ID cards numbered $(1,2,3,4.....N)$ and $M$ cells with 2 numbers $L$ and $R$. Every cell of the prison can be opened with a card with ID with a number $ i $ iff $L \leq i \leq R$ Now Alex is very lazy. He does not want to carry more than 1 ID card. So ,he asks you to help him. Find the number of IDs which can be used t

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