C# (Visual C# Interactive Compiler), 120115 bytes
s=>s[0]==s[^1]&s=>!s[..^1]s.Where((c,i)=>i<s=>i<1?c!=s[^1]:i>s.IndexOfLastIndexOf(s.Max())?c>=s[i+1]c>=s[i-1]:i<si>s.LastIndexOfIndexOf(s.Max())?s.Max()!=c:c<=s[i+1]c<=s[i-1]).Any()
Here is an overview of how this works...
- Input is in the form of a
string
- Find the largest digit
- Ensure the first and last digits are the same
- Ensure digits after the last occurrence of the largest digit are decreasing
- Ensure digits between the first and last occurrence of the largest digit are equal to the largest digit
- Ensure digits before the first occurrence of the largest digit are increasing