How to Circularly Sort an Array in Golang
The challenge
An array is circularly sorted if the elements are sorted in ascending order but displaced, or rotated, by any number of steps.
Complete the function/method that determines if the given array of integers is circularly sorted.
Examples:
These arrays are circularly sorted (true
):
While these are not (false
):
The solution in Golang
Option 1:
Option 2:
Option 3:
Test cases to validate our solution
|
|