Help in calculating time complixty

Revision en1, by M.A.H.M.O.O.D, 2017-05-02 20:49:11

Hi everyone.

I'm trying to solve this problem 559B - Equivalent Strings but I'm getting TLE here's my submission 26805388.

Now let's calculate the time complexity of this solution one call of function "is_equal" is O(n) in complexity because of the "substr" function which is linear in complexity.

Now for how many times we will call function "is_equal"...it should be O(log(n)) because each time we are halving the strings so the numbers of times I can do that is log(n) right ?

So the total time complexity should be O(NlogN) right ??? why am I getting TLE is there anything that I'm missing ??? I will be grateful for any help.

Thank you for reading.

:)

Tags strings, tle

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English M.A.H.M.O.O.D 2017-05-02 20:49:11 710 Initial revision (published)