Today’s blog post is about an interesting problem that has been posted on the 5th day of LeetCode’s June 2020 challenge.
The entire problem statement is available here. Here’s an example to follow along with the given description.
Imagine, we have an array of positive integers like: [3, 14, 1, 7] where the values at a particular index represents a weight corresponding to that index. So, index 0 has a weight of 3, index 1 has a weight of 14 and so on. We have to write a function pickIndex() that randomly picks an index proportional to it’s weight (i.e…
When I first came across dynamic programming I remember encountering an interesting problem called “Edit Distance”:
It served as an important non-trivial problem to understand recursive thinking and that’s why I decided to dedicate my first blog post to dissect it. Now, the solution that I had come up with is not the usual formulation that one would come across in the standard explanations of this problem. However, this formulation is quite interesting and it’s really a reverse way of looking at the standard solution.
The full problem statement is available in the description section of the link posted…