You will be given a string containing digits. You have to say the number of sub strings whose sum is divisible by 3.

This is a companion discussion topic for the original entry at https://toph.co/p/divisible-by-3

You will be given a string containing digits. You have to say the number of sub strings whose sum is divisible by 3.

This is a companion discussion topic for the original entry at https://toph.co/p/divisible-by-3

For(i,s.size())

For(j=i,s.size())

How it can be TLE?

There is a typing mistake. The maximum size of the string will be 10^6. That is why you got TLE.

1 Like

thank you…