Created
December 15, 2022 23:15
-
-
Save abdulrahmanAlotaibi/4fda6adceba6f48612bd660686ca8f1f to your computer and use it in GitHub Desktop.
Arrays Algorithims #1 : Delete Duplicates form a sorted array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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