This problem has either a bad statement, or is missing test cases.
If a solution is allowed to be O(target) time and/or memory, the problem statement should explicitly mention limits on target. For example, "it is guaranteed that target < 10^6".
If no such bound is giving on target, it cannot be assumed that solutions may use O(target) time/memory, and all those solutions which do should be failed by a test case like the following
nums =[1073741823, 715827882, 715827882, 306783378, 195225786, 69273666, 14221746, 6487866]
The target above is target = 2^31 - 2, which has factors [2, 3, 3, 7, 11, 31, 151, 331].
The nums above are nums = [target/factor for factor in factors]
The correct answer appears to be 14.
Most solutions which are O(target) should see TLE. Either a test case failing O(target) solutions should be added, or a limit on target should be given in the problem statement.