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 Data Structures

Game of Thrones

HBO Westworld

Technology

Featured Contributions

comment in this discussion

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)

comment in this discussion

comment in this discussion

comment in this discussion

comment in this discussion

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)