從排序數組中刪除重復項
===

> Go 判斷數組中是否包含某個 item
> go沒有則法國方法 可以采用 reflect 或者遍歷全部來實現,but reflect比循環還慢!!!
~~~
func TestOne(t *testing.T) {
nums := []int{1,1,2}
removeDuplicates(nums)
fmt.Println(nums)
}
func removeDuplicates(nums []int) int {
ns := []int{}
for _,v := range nums {
if excts(ns, v) {
ns = append(ns,v)
}
}
nums = ns[:]
fmt.Println(ns)
return len(ns)
}
func excts(ns []int,val int) bool {
for _,v := range ns {
if v == val {
return false
}
}
return true
}
~~~