Ad
  • Custom User Avatar

    I think this solution partially correct. It will not handle negative numbers properly. Moreover, why you walk from 2 to number - 1 - it is super ineffective way to find prime number! Proper solution is when you go to the square root of the number using property that a * b = n and when a <= sqrt(n), b >= sqrt(n).

  • Custom User Avatar

    Why it would work for case num = 2 ? I anticipate that this solution will return false. Correct me, please, if I am wrong in my assumption.