Skip to content

Commit

Permalink
Merge pull request #33 from HyperWoo/DSA--Hacktoberfest-
Browse files Browse the repository at this point in the history
Python Code for Smallest Positive in an Array
  • Loading branch information
TechVine authored Oct 13, 2022
2 parents 79139d0 + 1c8077f commit 908aeed
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Python/array/smallestPositiveNumber.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def getMAX(a):
found = False
n = len(a)
for i in range(1, n + 2):
found = False
for j in range(n):
if a[j] == i:
found = True
break
if found == False:
return i

#Driving Code

a = [2, 3, 7, 6, 8, -1, -10, 15]

print(getMAX(a))

0 comments on commit 908aeed

Please sign in to comment.