@crazystonesss This is not likely to be true.

A sub-problem of your request s to do primality test in O(1) time (since the answer for a prime input n is just w =1). However, the complexity of primality test is not found to be O(1).

Subcategories

LeetCode Weekly Contest 16B