antonykelvin7's blog

By antonykelvin7, history, 4 years ago, In English

Hi everyone,

This is my submission for the problem 1385D — a-Good String 87129805 . If I make the input string global and if I do not pass it inside the function every-time it gets accepted. I don't understand why it times out though?. Wouldn't the solution still be O(17.n)?. Thank you for your help.

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

You're passing a copy of the string each time you recurse. Just make it global or pass as reference.