Skip to content

Commit 3e37d2a

Browse files
committed
MATH_BUG01
1 parent 848bf15 commit 3e37d2a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)