Note:
---
采用二分法进行遍历
class Solution:
def removeElement(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
nums.sort()
i = 0
j = len(nums)-1
while i<=j:
med = i+(j-i)//2
if nums[med]==val:
nums.pop(med)
j-=1
elif nums[med]>val:
j=med-1
else:i=med+1
return len(nums)