Skip to content

Instantly share code, notes, and snippets.

@akashkathole7
Created March 9, 2022 10:02
Show Gist options
  • Save akashkathole7/877d37f570d6a3181f72ce98504bf22b to your computer and use it in GitHub Desktop.
Save akashkathole7/877d37f570d6a3181f72ce98504bf22b to your computer and use it in GitHub Desktop.
def search_insert_position(data,target):
i = 0
while i < len(data):
if data[i] == target:
return i
if data[i] > target < data[i]:
return i
i = i + 1
return (len(data))
# test the programme
a = [1,3,5,6,9,11,12]
print(search_insert_position(a,target = 6))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment