Skip to content

Instantly share code, notes, and snippets.

@frankchang0125
Created September 18, 2018 16:03
Show Gist options
  • Save frankchang0125/e57064a2348860b8f755caec44bba4a4 to your computer and use it in GitHub Desktop.
Save frankchang0125/e57064a2348860b8f755caec44bba4a4 to your computer and use it in GitHub Desktop.
27. Remove Element
func removeElement(nums []int, val int) int {
n := 0
for i, num := range nums {
if num != val {
nums[n] = nums[i]
n++
}
}
return n
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment