← All problemsSign in

String Issue

Alice gave Bob a string of length **N** with *lower case alphabets* only, where each unique element in the string is given a value based on the position it first occurs in the string (positions start from 1). Alice then asks Bob **Q** queries and for each query, Bob has to answer the *total value of substring* from position **L** to **R**. Bob is not that proficient in strings and asks for you he

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