O(sqrt(N)) Python solution


#1
class Solution:
# @param A : integer
# @return a list of integers
def allFactors(self, A):
    count = []
    final = []
    for i in range(1, int(math.sqrt(A))+1):
        if A % i == 0:
            count.append(i)
            final.append(i)
    
    for i in range(len(count)-1, -1, -1):
        if (A//count[i]) not in final: 
            final.append(A//count[i])
    return final