Queries on the String
You have a string of N decimal digits, denoted by numbers A1,A2, ..., AN. Now you are given M queries, each of whom is of following two types. - Type 1: 1 X Y: Replace AX by Y. - Type 2: 2 C D: Print the number of sub-strings divisible by 3 of the string denoted by AC,AC+1 ... AD. Formally, you have to print the number of pairs (i,j) such that the string Ai,Ai+1...Aj, (C ≤ i ≤ j ≤ D), when con
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