I tried to follow the same approach, of greedily choosing the minimum of available options.
Here is my solution,
I belive that the complexity in my code also is O(N**2) as in the original solution with DP.
Please let me know if I am wrong anywhere. Thanks.