Elegant code === 80. Remove Duplicates from Sorted Array II ```go= func removeDuplicates(nums []int) int { l := len(nums) if l < 2 { return len(nums) } idx := 2 for i := 2; i < len(nums); i++ { if nums[i] != nums[idx-2] { nums[idx] = nums[i] idx += 1 } } return idx } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up