[Question]
  [
A hill number is a number that has **the same digit in the first & the last**, but that's not all. In a hill number the first digits are **strictly increasing** until the largest digit, and after the largest digit, the last digits are **strictly decreasing. The largest digit can be repeated but consecutively only**, meaning no gaps by smaller numbers.
Here is an example of a hill number:
```
12377731 | 1237...             | ...731
^ same ^ | strictly increasing | strictly decreasing 
---------+---------------------+---------------------
12377731
   ^^^ okay because largest digit can be repeated
```
This is **not**:
```
4588774 | ...8774
        |     ^^ not the largest digit
        |        so this has to be strictly decreasing
        |        but it's not, so not a hill number
```
### Challenge
Given a positive integer, write a full program or a function that returns truthy for hill numbers but falsy on other values.
**Notes:**
* Input & output can be in **any reasonable format**.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so shortest answer in each language wins!
### Test Cases
```
12321 -> Truthy
1233321 -> Truthy
99 -> Truthy
3 -> Truthy
234567992 -> Truthy
5555555 -> Truthy
1232 -> Falsy
778896 -> Falsy
23232 -> Falsy
45566554 -> Falsy
5645 -> Falsy
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 bytes
```
_ƝṠÞ+SƊƑ
```
[Try it online!](https://tio.run/##y0rNyan8/z/@2NyHOxccnqcdfKzr2MT/h9sfNa0BIgX3//@jDY2MjQx1FICUMZhhaamjYKyjYGRsYmpmbmlpFKujAFajo2BubmFhaQaSAnNNTE3NzExNTXQUTM1MTGMB "Jelly – Try It Online")
### How it works
```
_ƝṠÞ+SƊƑ  Main link. Argument: n (integer)
_Ɲ        Take the differences of neighboring digits.
          This maps n = abcd to [a-b, b-c, c-d].
       Ƒ  Fixed; apply the link to the left and return 1 if the result is equal to
          its argument, 0 if not.
      Ɗ       Drei; combine the three links to the left into a monadic chain.
  ṠÞ              Sort the differences by their signs (negative, zero, positive).
     S            Take the sum of the differences, yielding 0 if and only if the
                  first digit is equal to the last.
    +             Add the sum to each difference.
```
[Answer]
# JavaScript (ES6), ~~62~~ 54 bytes
Takes input as a string. Returns a Boolean value.
```
s=>s[-[...s].some(p=q=n=>q>(q=Math.sign(p-(p=n))))]==p
```
[Try it online!](https://tio.run/##fc69DoIwFIbh3atgowyU0NJChzK6ubkRBoL8GWwLRROvvoJRNCHlW8@TN@daPApdjp2afCEvlam50TzVmZ9BCHUOtbxVQPGBC54OKRj4qZhaqLtGAOXPB@HNyzlXppRCy76CvWxADdwQYRS6nucsCwLnPN6n9nnYKrw6q2LsG9pT@A/ZFcIRoTFjaNF7f6E1N6tj0esNiuMkYfTDbGgO/VI2FBFCKSHR29kQoRHZ/GRe "JavaScript (Node.js) – Try It Online")
### Commented
```
s =>                  // s = input string
  s[                  // we will eventually access either s[0] or s[-1]
    -[...s].some(     // depending on the result of this some()
      p = q =         // initialize p and q to non-numeric values
      n =>            // for each digit n:
        q > (         //   compare q with
          q =         //   the new value of q,
          Math.sign(  //   defined as the sign of
          p - (p = n) //   the difference between the current digit and the previous one
        ))            //   yield true if the previous q is greater than the new q
    )                 // s[-1] being undefined, a truhty some() will force the test to fail
  ] == p              // otherwise: test if the 1st digit s[0] is equal to the last digit p
```
---
# JavaScript (ES6), 65 bytes
A solution using a regular expression. Takes input as a string. Returns \$0\$ or \$1\$.
```
s=>/N(,-\d+)*(,0)*[^0-]*$/.test([...s].map(p=v=>p-(p=v)))&p==s[0]
```
[Try it online!](https://tio.run/##fc67DoIwGIbh3atgMNIiFCi02KGOjk5uiEnDwUNQGoskXj2CUTQh5V/@5cmb7yIaodL7WdbOrcrytuCt4mt3C2xnny2hBWwPWvHBcxJr7qI6VzWIEUIqQVchgeQNX0un/xDCheRcxV7SptVNVWWOyuoICmD6OMC@CaHRn@sau/ujPj1nYxUMTqsY@4amVPCH9AoHIaERY7jXU7vwkOvURpRqhKJotWL0w3SoC/1SOhQSQikh4dvpEKEhGW1qXw "JavaScript (Node.js) – Try It Online")
### How?
We first convert the number to a list of pairwise digit differences in \$[-9,9]\$:
```
[...s].map(p = v => p - (p = v))
```
*Example:*
```
"234567992" --> [ NaN, -1, -1, -1, -1, -1, -2, 0, 7 ]
```
This array is coerced to a string, which gives:
```
"NaN,-1,-1,-1,-1,-1,-2,0,7"
```
We apply the following regular expression:
```
 +-----------------------> the second 'N' of 'NaN'
 |    +------------------> a sequence of negative numbers
 |    |     +------------> a sequence of zeros
 |    |     |     +------> a sequence of positive numbers
 |    |     |     |  +---> end of string
 |    |     |     |  |
 |/¨¨¨¨¨¨\/¨¨¨\/¨¨¨¨\|
/N(,-\d+)*(,0)*[^0-]*$/
```
Finally, we also test if the last digit `p` is equal to the first digit `s[0]`.
[Answer]
# Pyth, 16 bytes
```
&SI_._MJ.+jQT!sJ
```
[Try the test suite](http://pyth.herokuapp.com/?code=%26SI_._MJ.%2BjQT%21sJ&input=12377731&test_suite=1&test_suite_input=12321%0A1233321%0A99%0A3%0A234567992%0A1232%0A778896%0A23232%0A45566554%0A5645&debug=0).
```
          jQT          input in base 10
       J.+             J = differences: [3,1,4,1] -> [-2,3,-3]
    ._M                Signs of each element of J
   _                   Reverse the list
 SI                    and check if it is Invariant under Sorting.
                       If this is true, J consists of some positive numbers,
                         followed by some 0s, followed by some negative numbers,
                         which is what we want.
            !sJ        Now we check the other hill condition by ensuring
                         sum(differences) = 0; i.e. the first and last digit are equal.
&                      We take the logical AND of both conditions.
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
DIµṠNṢƑaS¬$
```
Explanation:
```
D               Convert to a list of Digits.
 I              Increments; compute differences between successive elements.
  µ             Start new µonadic link.
   Ṡ              Find Ṡign of each increment
    N             then negate;
     ṢƑ           is the result invariant under Ṣorting?
                  If so, the increments consist of some positive numbers,
                     followed by some 0s, followed by some negative numbers,
                     which is what we want.
       a          Logical AND this result with
        S¬$       logical NOT of the Sum of the increments.
                  If the sum of the increments is zero, first and last digits are equal.
```
[Try it online!](https://tio.run/##ASQA2/9qZWxsef//REnCteG5oE7huaLGkWFTwqwk////MTIzNzc3MzI "Jelly – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 39 bytes
```
{.[0]==.tail&&[<=] $_ Z<=>.skip}o*.comb
```
[Try it online!](https://tio.run/##VczBCoJAFAXQdfMVbxGiYUOOzuiQ47IvaJVIWClJmuIoIea32xCRunvnXu6rkjpnY9GBloIYexzuIiFwE2e5poW@iGB9hpMvAiwfWTWUG3wti8u4R2lZg55nz0Qa0KNV1Tagpzp@lfVNqh@GCe8fiKmIhtEiNrFgG8Cxbpt7h5TtZcL5DPbsJrZDmcs5Wc6/PMS57JDreh5nk1U5rx1KGaPUmRLKHPrXBw "Perl 6 – Try It Online")
### Explanation
```
{ ... }o.comb  # Split into digits and feed into block
.[0]==.tail    # First element equals last
&&             # and
     $_ Z<=>.skip  # Pairwise application of three-way comparator
[<=]           # Results never decrease
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~114~~ 112 bytes
```
lambda n:all((n[0]==n[-1])*sorted(set(x))==list(x)[::d]for x,d in zip(n.split(max(n)*n.count(max(n)),1),[1,-1]))
```
[Try it online!](https://tio.run/##fc2xDoIwFAXQ3a9o4mBr0NhCiyWpo1/ghgxVIDSpD0Jrgv486qDBoWzv5uTe1z180wIba3Uerb5dSo0g09ZiDPmuUAryDS3I2rW9r0rsKo8HQpSyxn2uPMvKom57NEQlMoCepsOwdZ01Ht/0gIGsYXtt7/CNJKIkymn0GSVj1xvwqMYrymJGVwQt0eaATv3dN4/FFOMZljIkcQhYnHCRSslmXv7sqK2bUJru91IE8F0LFhPOheA8CTAXCf@j8QU "Python 2 – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 65 bytes
Takes strings. Took the idea for checking sort invariance from the Pyth answer.
```
function(a)!sum(d<-diff(utf8ToInt(a)))&all(sort(k<-sign(d),T)==k)
```
[Try it online!](https://tio.run/##bc7LCoMwEAXQfb/CWigz0CzMSwPaZaF7f0AqaUWNYJJFvz6VvhbGWZ57ucwcdFKSoL25uW4y0ODe@hHakrSd1uCdLurpatwSIB6bYQA7zQ76ktjubqDFU41V1WPQkGaU0SzFQ0LOST1793juPsq2XKmIWCSUcSFzpejW7A8vzWDfludFoeRal2Jc5UJIKQRfu5BcRAPfW/z/QngB "R – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~19~~ ~~17~~ ~~13~~ 12 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
¥D.±Â{RQsO_*
```
-5 bytes by creating a port of [*@lirtosiast*'s Pyth answer](https://codegolf.stackexchange.com/a/176228/52210).
[Try it online](https://tio.run/##yy9OTMpM/f//0FIXvUMbDzdVBwUW@8dr/f9vYmphYW5uAgA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn3l/0NLXfQObTzcVB0UWOwfr/Vf57@hkbG5ubmxIReQYQQmjUG0pSWXMZeRsYmpmbmlpRGXiamFhbm5CVgRl7m5hYWlGVAWxDExNTUzMzU14TI1MzEFAA).
**Explanation:**
```
¥           # Push the deltas of the digits of the (implicit) input
            #  i.e. 4588774 → [1,3,0,-1,0,-3]
 D          # Duplicate this list
  .±        # Get the sign of each
            #  [1,3,0,-1,0,-3] → [1,1,0,-1,0,-1]
    Â       # Bifurcate (short for DR: Duplicate and Reverse copy)
            #  i.e. [1,1,0,-1,0,-1] → [-1,0,-1,0,1,1]
     {      # Sort the copy
            #  i.e. [-1,0,-1,0,1,1] → [-1,-1,0,0,1,1]
      R     # Reverse it
            #  i.e. [1,1,0,0,-1,-1]
       Q    # And check if they are equal
            #  i.e. [1,1,0,-1,0,-1] and [1,1,0,0,-1,-1] → 0 (falsey)
s           # Swap to get the list of deltas again
 O          # Take the sum
            #  i.e. [1,3,0,-1,0,-3] → 0
  _         # And check if it's exactly 0
            #  0 → 1 (truthy)
*           # Check if both are truthy (and output implicitly)
            #  i.e. 0 and 1 → 0 (falsey)
```
`Â{RQ` can alternatively be `(Â{Q` for the same byte-count, where `(` negates each sign: [Try it online](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn3l/0NLXfQObdQ43FQdWOwfr/Vf57@hkbG5ubmxIReQYQQmjUG0pSWXMZeRsYmpmbmlpRGXiamFhbm5CVgRl7m5hYWlGVAWxDExNTUzMzU14TI1MzEFAA).
[Answer]
# J, 23 bytes
```
[:((0=+/)**-:*/:*)2-/\]
```
Idea stolen from the Jelly answers. Just wanted to see how short I could make it in J.
[Try it online!](https://tio.run/##bU67DsIwDNzzFSeWNoE0aVIKjZQJiYmJFZgqKsTC/0/BLgwJRSfb8t358UyrppoQAypsYBEodIPD@XRMl1DXNq6NVEoHZYKSTpvrLUkh7uPjhRYRE2UHj90Mj3YpOapL1v9RBkLe@6LjqQ5b9HSIne77hi1u5Ry/tCcMNJPzH@evm3fz9n6uXaExz7qASG8 "J – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 53 bytes
```
def f(s):x=map(cmp,s,s[1:]);s[:sorted(x)==x]!=s[-1]>_
```
Takes input as a string. Output is via [presence or absence of an exception](https://codegolf.meta.stackexchange.com/a/11908/12012 "Functions may return a boolean value via the presence or absence of an error/exception"). 
[Try it online!](https://tio.run/##RY5Bi8IwEIXP9VfM3hKIh6ZNarJ0b3r05K0UKZqiYNswk4X662tSEU9vvjePN@Of4TaNclmuroeeEbdzPXSeXQYvSFCT25b/UmNpwuCubOZ1Pbc/NTXbvP07L/2EEBwFgvsILJeFzAVEKdbBGAGFAFmUSlfGSC7eGQFVtdsZnVYrlkpprVQpQOlScbvJPsWpdz0QvSzgM0kW/wzIks15Yo/3McAJ/10kN1@cD3DsBrdHnNB@E4fuQTGywvIC "Python 2 – Try It Online")
---
# [Python 2](https://docs.python.org/2/), 62 bytes
```
lambda s:s[:eval('<='.join(map(str,map(cmp,s,s[1:]))))]==s[-1]
```
Takes input as a string and returns a Boolean.
[Try it online!](https://tio.run/##NY7RDoIwDEWf5Sv6xpZUkw022CJfgjygQsTAWOhi4tcjg9iX23va3NZ/w2t2cu2hgts6ttP92QJZqm33aUeWXqv08p4Hx6bWMwoLRn1MHgmpFrbhWzVVRfVZNGs/LxA6CgSDAyZkJgXCJtneGIOQIcgsV7owRnI8dhCKoiyNjqPd5kpprVSOoHSuuE1O/@CYux/Y2MkvgwvQx69YhJwnB1t/ "Python 2 – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 12 bytes
```
dZSd1<AGds~*
```
[Try it online!](https://tio.run/##y00syfmf8D8lKjjF0MbRPaW4Tuu/S1RFyH91QyNjI0N1LhBtDGFZWgIJYyA2MjYxNTO3tDSCSIMoc3MLC0szdQWQJETExNTUzMzU1ATINDUzMQVpgwJ1AA "MATL – Try It Online")
### Explanation
Input is a string of digits. Output is a `1` or `0`. The number `222222` is a hill number according to this program. Saved 2 bytes by copying Dennis' method for checking equality of the first and last digits.
```
d               % Takes the difference between digits
 ZS             % Calculate the sign. 
   d            % Take the difference again. 
    1<          % A number is a hill number if these differences are < 1.
      A         % Truthy iff above is all true OR if array is empty (necessary for short inputs)
       Gds      % Push the input, and sum all the differences.
          ~     % Negate
           *    % Multiply the two tests (=logical AND).
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 47 bytes
```
->n{(r=n.each_cons(2).map{|a,b|a<=>b})==r.sort}
```
[Try it online!](https://tio.run/##JYzRCoMgGEZfZZcJTkj9LSF7kYihzbYuZqJtNLJnd8VuvsM5F194m28eVb62biuCcsTq4XkbZhcLishL@y1pbJJuVGt2pFQgcQ7LnruSMlriY9lJKTHDlHEQlZT0zBRXVV1LcdRTOIAQAByD4ND/j9fkL2Pni5Xcp8e0RBLsx4ZoUb/nHw "Ruby – Try It Online")
Input as array of digits, output is boolean.
[Answer]
# Mathematica/Wolfram Language, 69 64 bytes
Pure function. Takes input as an integer, returns `True` or `False`.
```
Sort[x=Sign@-Differences[y=IntegerDigits@#]]==x&&y[[1]]==Last@y&
```
### Explanation:
The first clause checks the "hilliness":
* `IntegerDigits`: Get digits from integer. Store in `y`.
* `-Differences`: Take successive differences and flip signs.
* `Sign`: Replace each entry with +1 if positive, 0 if zero, and -1 if negative. Store in `x`.
* `Sort`: Sort list of +1, 0, -1 from smallest to largest. Compare to original list in `x`.
The second clause checks whether the first and last digits are equal.
A tip of the hat to @IanMiller for tips on refining this code.
[Answer]
# Japt, 11 bytes
Takes input as a digit array.
```
ä-
eUñg)«Ux
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.6&code=5C0KZVXxZymrVXg=&input=WzEsMiwzLDIsMV0=) or [run all test cases](https://ethproductions.github.io/japt/?v=1.4.6&code=5C0KZVXxZymrVXg=&input=WwpbMSwyLDMsMiwxXQpbMSwyLDMsMywzLDIsMV0KWzksOV0KWzNdClsyLDMsNCw1LDYsNyw5LDksMl0KWzEsMiwzLDJdCls3LDcsOCw4LDksNl0KWzIsMywyLDMsMl0KWzQsNSw1LDYsNiw1LDUsNF0KWzUsNiw0LDVdCl0KLW1S)
```
             :Implicit input of digit array U
ä-           :Deltas
\n           :Reassign to U
 Uñ          :Sort U
   g         :  By signs
e   )        :Check for equality with U
     «       :Logical AND with the negation of
      Ux     :U reduced by addition
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 115 bytes
```
s=>!s.Where((c,i)=>i<1?c!=s[^1]:i>s.LastIndexOf(s.Max())?c>=s[i-1]:i>s.IndexOf(s.Max())?s.Max()!=c:c<=s[i-1]).Any()
```
[Try it online!](https://tio.run/##fc7NCoJAFAXgfU@hrmYgDX9mbMoZaSMERS2CFlFgk@aAKHgN8unNhUQR0@7Cdw7nSrAlqD55VDKCtlHVfXqt61IYucF74MIE51hkTYaQnCrMhYrcWJocThf3vFACnE0K7bq6Zc9djsDZpk@EcSzFkFD2GPnh8TC5XMhoTGJnVXUI98vJZD@80aIcWa7ne66F8dKYzYxD82iL7gv9P8yYTnwdeH5AaMiY92fybUlawgeF4XzOqAaHmrYYEEIpIYGGCQ3IF/Uv "C# (Visual C# Interactive Compiler) – Try It Online")
Here is an overview of how this works...
1. Input is in the form of a `string`
2. Find the largest digit
3. Ensure the first and last digits are the same
4. Ensure digits after the last occurrence of the largest digit are decreasing
5. Ensure digits between the first and last occurrence of the largest digit are equal to the largest digit
6. Ensure digits before the first occurrence of the largest digit are increasing
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 22 bytes
```
XXJl_-]==j2COqcm^mso&&
```
[Try it online!](https://tio.run/##SyotykktLixN/f8/IsIrJ1431tY2y8jZvzA5Ny63OF9N7f9/QyNjIDAyBAA "Burlesque – Try It Online")
```
XX    # Explode into digits
J     # Duplicate
l_-]  # Head & Tail
==    # Are equal
j     # Reorder stack
2CO   # 2-grams
qcm^m # Compare with UFO operator
so    # If sorted
&&    # If going up then down AND head-tail is equal
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 52 bytes
```
.
$*1;$&$*1,
(1+),\1
,
^(1+);(,1+;)*(,;)*(1+,;)*\1,$
```
[Try it online!](https://tio.run/##FYgxDoMwDEV3nyNFgVhIdmIHKwfgEgjB0KFLh6r3D/Hy3v/v9/5/vnd/xf3qK4SFWpgGESKlGQ8ChNNni0ipzUtEByXXQRh6J85MMJjdZpCBcxGtZuyZodZtMx3VTxFRFSkgWuQB "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation:
```
.
$*1;$&$*1,
```
Convert each digit to unary twice, separated by `;`s and terminated by `,`s. However, you can then think of the result as the first digit, a `;`, then all the pairs of adjacent digits, the digits of each pair separated by `,` and the pairs separated by `;`s, then another `;`, then the last digit, then a final `,`.
```
(1+),\1
,
```
Subtract the pairs of adjacent digits. This leaves `;,;` for equal digits and `1`s on the greater side for unequal digits. (This could be done as part of the following regex but obviously that wouldn't be so golfy.)
```
^(1+);(,1+;)*(,;)*(1+,;)*\1,$
```
Match the first digit, then any number of pairs of ascending digits, then any number of pairs of equal digits, then any number of pairs of descending digits, then match the first digit again at the very end.
[Answer]
# [Red](http://www.red-lang.org), 181 bytes
```
func[n][m: last sort copy t: s: form n
parse t[opt[copy a to m(a: sort unique a)]copy b thru any m
opt[copy c to end(c: sort/reverse unique c)]](s = rejoin[a b c])and(s/1 = last s)]
```
[Try it online!](https://tio.run/##TY7LDoMgEEX3fsVd6qrxgQpJf6JbwoIipjYVLGCTfr21tVF2986ZMxmnu@WiOy6Sni39bBQ3go8MD@kDvHUByk5vBAbP0Fs3wiSTdF4jcDsF/qMSwWJMJduM2QzPWUNm4kevCDc3Q5o3xmR31NfRpkvVZp2cfunv3b@tMiFSjzOcvtvBcLneUSKTq@FP@TrfPszEMrnBBPTIi7LIk6iVcad0j@WeirIidUNpEWtHaZq2pXW0HcOKkPpgpK7I8gE "Red – Try It Online")
## More readable:
```
f: func[n][
    t: s: form n                                    
    m: last sort copy t                             
    parse t [ opt [ copy a to m (a: sort unique a) ] 
              copy b thru any m
              opt [ copy c to end (c: sort/reverse unique c) ]
            ]
    (s = rejoin [ a b c ]) and (s/1 = last s)
]
```
[Answer]
# Powershell, 77 bytes
```
($x=-join("$($args|%{"-$_;$_"})"|iex))-match'^(-\d)+0*\d+$'-and$x[1]-eq$x[-1]
```
Less golfed test script:
```
$f = {
                                           # $args = 1,2,3,3,3,2,1
$a=$args|%{"-$_;$_"}                       # "-1;1","-2;2","-3;3","-3;3","-3;3","-2;2","-1;1"
$d="$a"                                    # "-1;1 -2;2 -3;3 -3;3 -3;3 -2;2 -1;1"
$x=-join($d|Invoke-Expression)             # "-1-1-100111"
$x-match'^(-\d)+0*\d+$'-and$x[1]-eq$x[-1]  # $true or $false
}
@(
    ,($True , 1,2,3,2,1 )
    ,($True , 1,2,3,3,3,2,1 )
    ,($True , 9,9 )
    ,($True , 3 )
    ,($True , 2,3,4,5,6,7,9,9,2 )
    ,($False, 1,2,3,2 )
    ,($False, 7,7,8,8,9,6 )
    ,($False, 2,3,2,3,2 )
    ,($False, 4,5,5,6,6,5,5,4 )
    ,($False, 5,6,4,5 )
) | % {
    $expected,$a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}
```
Output:
```
True: True
True: True
True: True
True: True
True: True
True: False
True: False
True: False
True: False
True: False
```
[Answer]
# [Python 3](https://docs.python.org/3/), 114 bytes
```
def f(r):
 l=[*r]
 for i in-1,0:
  while 1<len(l)and l[i]<l[(1,-2)[i]]:l.pop(i)
 return 2>len({*l})and r[0]==r[-1]
```
[Try it online!](https://tio.run/##ZZDRaoMwFIbvfYpDQUhKLE00WqXZ5Z5gd@KFq5EGQgxJyjbGnt2lsgm2d/m/fP@Bc@xXuE4mn@dBjjAih5sEtGj3rktgnBwoUCaj5BgxfFyVlkDPWhqkcW8G0K3qzrpFlGQMx3fX6IOdLFI4ASfDzRlgL3f9e69/loZrj50Qrs1oNwfpw6X30oMAFOcDIMpyRgm8uZvEZEX5E6zrbc63keUFL6u6Zk@jInnttV9RVZ1OdfkAo/YkFpyXJefFA@Zlwck/wUmy3MxYAvLTykuQQ0ywLtosJeuUCWiX@gZSv4MU0KaB8WK55S4j8sHd//9o7710Ad6nSaNoYBBiLc6/ "Python 3 – Try It Online")
Way longer than some Python 2 solutions, but this one is def-based and I like it.
]