aakarshmadhavan's blog

By aakarshmadhavan, history, 2 months ago, In English,

I have a very interesting problem I feel you will all appreciate!

I have solved with brute force, but it is not fast enough. I am thinking I must use dynamic programming to help and I tried using memoization but still not fast enough.

Here is my code: Code link Java DP + recursion

Please give me sone hints how to make it faster (top down DP) or how to improve my code to get faster. Thank you

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

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

constraints?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I've solved it already, the optimization was just a 2d memo :(

    anyway, constraint was

    ring.length() <= 100 key.length() <= 45