December_day_4

Leetcode December Challenge Day 4 Link to heading

Link to the question

Solution to the question

class Solution(object):
    def kthFactor(self, n, k):
        """
        :type n: int
        :type k: int
        :rtype: int
        """
        i = 1
        while i<=n:
            if n%i == 0:
                k -= 1
            if k == 0:
                return i
            i += 1
        return -1