Garv and Lottery Tickets
CodeChefOpen on judge ↗
There are $N$ lottery tickets with numbers written on them. Garv wants to buy some lottery tickets, but he is kind of superstitious. He has a lucky digit $X$, and he wants you to answer $Q$ queries before he buys the tickets. Each query will contain 2 numbers $L$ and $R$. You will need to output the sum of occurrences of the digit $X$ in the numbers between positions $L$ and $R$ (both inclusive)
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.
Sign in to chat with the tutor and save your progress.
Sign in to start