Dynamic Programming Logic Python3
\n\n# 1. Dynamic Programming\n\nclass Solution:\n    def nthUglyNumber(self, n: int) -> int:\n        list1=[0]*n\n        list1[0]=1\n        a=b=c=0\n        
\n\n# 1. Dynamic Programming\n```\nclass Solution:\n    def nthUglyNumber(self, n: int) -> int:\n        list1=[0]*n\n        list1[0]=1\n        a=b=c=0\n        for i in range(1,n):\n            list1[i]=min(list1[a]*2,list1[b]*3,list1[c]*5)\n            if list1[a]*2==list1[i]:a+=1\n            if list1[b]*3==list1[i]:b+=1\n            if list1[c]*5==list1[i]:c+=1\n        return list1[n-1]\n        \n    #please upvote me it would encourage me alot\n\n```\n\n# please upvote me it would encourage me alot\n
['Python3']