For Subtask 1 :
Just Generate all possible substring and count the Tokushuna Substring .
Overall Complexity O(n2)
For Subtask 2 :
Tavares the string from beginning and if find any '1' then check the previous '1' in the string .
If (Position of curr '1' — position of previous '1') > 1 then this is a Tokushuna string count this . And finally Output this .
Overall Complexity O(n)

Statistics

80% Solution Ratio
prodip_bsmrstuEarliest, Aug '20
iammarajulFastest, 0.0s
Aimon026Lightest, 0 B
zahid147Shortest, 95B
Toph uses cookies. By continuing you agree to our Cookie Policy.