How to Reimplement the Unix Uniq Command in Golang
The challenge
Implement a function which behaves like the uniq
command in UNIX.
It takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance.
Example:
|
|
The solution in Golang
Option 1:
Option 2:
Option 3:
Test cases to validate our solution
|
|