DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

golangchar
golangchar

Posted on

How to Delete Duplicate Numbers in Golang

#go
func Set(arr []int) []int {
    for i := 0; i < len(arr); i++ {
        for j := 0; j < len(arr); j++ {
            if arr[i] == arr[j] && i != j {
                arr = append(arr[:j],arr[j+1:]...)
            }
        }
    }
    return arr
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Why You Need to Study Javascript Fundamentals

The harsh reality for JS Developers: If you don't study the fundamentals, you'll be just another β€œCoder”. Top learnings on how to get to the mid/senior level faster as a JavaScript developer by Dragos Nedelcu.