프로그래밍/LeetCode
[LeetCode][Python3] 35. Search Insert Position
snoopybox
2018. 9. 12. 01:31
Problem :
https://leetcode.com/problems/search-insert-position/description/
My Solution :
class Solution:
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
i = 0
while i < len(nums):
if target <= nums[i]:
return i
i += 1
return i