← All problemsSign in

Sum Of Sub-String

Krushna loves to play with Strings. He takes a string S and finds all the distinct sub-strings of S. He has to find the Z values for each distinct substring and add it up. Z value of a substring si is Fsi* |si|. Fsi is frequency of si in string S. |si| is the length of si His friend Sagar visited him. Sagar has come up with a new string compression algorithm. The compression algorithm works as

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