Created
March 9, 2022 10:02
-
-
Save akashkathole7/877d37f570d6a3181f72ce98504bf22b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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