We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 848bf15 commit 3e37d2aCopy full SHA for 3e37d2a
Python/Interviewbit/Math/mathbug01.py
@@ -0,0 +1,16 @@
1
+"""
2
+Problem Link: https://www.interviewbit.com/problems/mathbug01/
3
+
4
+Following code tries to figure out if a number is prime
5
+However, it has a bug in it.
6
+Please correct the bug and then submit the code.
7
8
+class Solution:
9
+ # @param A : integer
10
+ # @return an integer
11
+ def isPrime(self, A):
12
+ upperLimit = int(A**0.5)
13
+ for i in xrange(2, upperLimit + 1):
14
+ if A % i == 0:
15
+ return 0
16
+ return int(A != 1)
0 commit comments