Integer Keys and Duplicates
JavaScript (ES6),  88 75 71  69 bytes

a=&gt;(g=_=&gt;!a.reverse().some(o=(v,i,[k])=&gt;v-k&amp;&amp;o[v]&amp;(o[v]=i&lt;=k)))()&amp;g()

Try it online!
Commented
The function \$g\$ reverses the input array and performs the test with the resulting leading key.
g= _ =&gt;               // g takes no explicit input
  !a.reverse()        // reverse the input array a[]
  .some(o =           // we use the object o to store encountered values
    (v, i,            // for each value v at position i in a[],
           [k]) =&gt;    // with k = leading value:
      v - k &amp;&amp;        //   abort if v is equal to the key
      o[v] &amp;          //   otherwise, test whether o[v] is already set
      (o[v] = i &lt;= k) //   and i is less than or equal to the key,
                      //   in which case o[v] is set
  )                   // end of some()

The main function simply invokes \$g\$ twice.
a =&gt; g() &amp; g()