Created
March 13, 2023 16:23
-
-
Save andresr-dev/a4e4864f2f552ac2552ef1e28d4a292b to your computer and use it in GitHub Desktop.
This is how to check if an array is sorted
This file contains hidden or 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
extension Array where Element: Comparable { | |
func isSorted() -> Bool { | |
self == self.sorted() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment