7 kyu
Monotone travel
582 of 6,772bkaes
Description:
Story
Peter lives on a hill, and he always moans about the way to his home. "It's always just up. I never get a rest". But you're pretty sure that at least at one point Peter's altitude doesn't rise, but fall. To get him, you use a nefarious plan: you attach an altimeter to his backpack and you read the data from his way back at the next day.
Task
You're given a list of compareable elements:
Ord a => [a]
Your job is to check whether for any x
all successors are greater or equal to x
.
isMonotone [1,2,3] == True
isMonotone [1,1,2] == True
isMonotone [1] == True
isMonotone [3,2,2] == False
If the list is empty, Peter has probably removed your altimeter, so we cannot prove him wrong and he's still right:
isMonotone [] == True
Such a sequence is also called monotone or monotonic sequence, hence the name isMonotone
.
Lists
Fundamentals
Similar Kata:
Stats:
Created | Oct 21, 2014 |
Published | Oct 21, 2014 |
Warriors Trained | 10964 |
Total Skips | 995 |
Total Code Submissions | 23035 |
Total Times Completed | 6772 |
Haskell Completions | 582 |
Python Completions | 2877 |
JavaScript Completions | 2672 |
Ruby Completions | 766 |
C# Completions | 230 |
C Completions | 86 |
COBOL Completions | 6 |
Total Stars | 91 |
% of votes with a positive feedback rating | 91% of 665 |
Total "Very Satisfied" Votes | 566 |
Total "Somewhat Satisfied" Votes | 84 |
Total "Not Satisfied" Votes | 15 |