Subset sum problem to a target

how can we solve the subset sum problem to a target in O(n*sum), (1<= n <= 5000 1<= sum <= 10^7 1<= Ai <=10^5)… this question is from master dynamic programming course. Is there any solution for this?

top down approach for subset sum target