Skip to content

Instantly share code, notes, and snippets.

@abdulrahmanAlotaibi
Created December 15, 2022 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdulrahmanAlotaibi/4fda6adceba6f48612bd660686ca8f1f to your computer and use it in GitHub Desktop.
Save abdulrahmanAlotaibi/4fda6adceba6f48612bd660686ca8f1f to your computer and use it in GitHub Desktop.
Arrays Algorithims #1 : Delete Duplicates form a sorted array
func deleteDuplicatesSortedArray(arr []int)[]int{
for i:= 0 ; i < len(arr) - 1 ; i++ {
if arr[i] == arr[i+1]{
arr = append(arr[:i], arr[i+1:]...)
}
}
return arr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment