How to Detect if Numbers are in Order in Golang
The challenge
In this challenge, your function receives an array of integers as input. Your task is to determine whether the numbers are in ascending order. An array is said to be in ascending order if there are no two adjacent integers where the left integer exceeds the right integer in value.
For the purposes of this challenge, you may assume that all inputs are valid, i.e. non-empty arrays containing only integers.
Examples:
The solution in Golang
Option 1:
Option 2:
Option 3:
Test cases to validate our solution
|
|