The complexity is O(n^2) as you are building the whole sub-string again (StringBuilder function is called n times).
Okay Thanks, i had read somewhere that appending as well as deleting from 0th index would only take o(1). Can you point you whats wrong with the algo as it gave WA in the contest? or any edge cases iām not considering.
anyone can explain the logic behind prefix array & sliding_window used in this question?