This is a very well written article by Michal Danilak. It teaches you how to come up with solutions for DP problems. Go through this only after the tutorials mentioned above.

I highly recommend this. It has really helped me a lot.

Active In

Competitive Programming

Narcos

Artificial Intelligence

Bitcoin and Blockchain

Algorithms and Computer Programming

Game of Thrones

HBO Westworld

Technology

Featured Contributions

reply in this discussion

Ankit Gupta43w

This is a very well written article by Michal Danilak. It teaches you how to come up with solutions for DP problems. Go through this only after the tutorials mentioned above.

I highly recommend this. It has really helped me a lot.

Read more… (60 words)

reply in this discussion

reply in this discussion

reply in this discussion

reply in this discussion

Ankit Gupta46w

I have done the question using STL set. Time complexity is O(N*logX*logY) assuming N is greater than X and Y.

I want to know if I can do better than this. Going through your hints, I do not understand how you are tracking wormhole W. Are you going to linearly scan through all W after finding the optimal V?

Read more… (59 words)