# 周边国家

54

``````1 1 2 2 1 3 3 2 4
``````

``````2 2 1 3 3 2
``````

## 测试用例

``````+----------------------+--------+
|        Input         | Output |
+----------------------+--------+
| 1                    | False  |
| 2 1 3 2              | True   |
| 2 1 2 1 2            | True   |
| 1 2 3 1 2 3          | False  |
| 1 3 1 2 2 3 2 3      | True   |
| 1 2 2 1 3 2 3 3 4    | False  |
| 1 2 3 4 5 6 7 8 9 10 | False  |
+----------------------+--------+
``````

21

Mego

33

## Pyth，7个字节

``````n{Q_{_Q
``````

``````n      Check whether the following are not equal:
{Q     The unique elements in order of first appearance
_{_Q   The unique elements in order of last appearance
(done by reversing, taking unique elts, then reversing again)
``````

12

## 视网膜，61 60字节

``````(\b(\d+)\b.* (?!\2 )(\d+) .*\b\2\b)(?!.* \3\b)(?<!\b\3 .*\1)
``````

11

## Python，64位元组

``lambda l,S=sorted:S(l,key=l.index)!=S(l,key=l[::-1].index)[::-1]``

``````g=lambda l:sorted(l,key=l.index)
lambda l:g(l)[::-1]!=g(l[::-1])``````

6

# C＃，113个字节

``````public bool V(int[] n){var u1=n.Distinct();var u2=n.Reverse().Distinct().Reverse();return !u1.SequenceEqual(u2);}
``````

``````public bool ContainsSurroundedCountry(int[] numbers)
{
int[] uniqueLeftmost = numbers.Distinct().ToArray();
int[] uniqueRightmost = numbers.Reverse().Distinct().Reverse().ToArray();

return !uniqueLeftmost.SequenceEqual(uniqueRightmost);
}
``````

1

wizzwizz4 2016年

2

Doorknob

1

4

# Japt，12个字节

``````Uâ ¬¦Uw â ¬w
``````

``````var a = [1], b = [1]; alert(a==b); // false
var a = [1], b = a;   alert(a==b); // true
``````

``````Uâ ¦Uw â w
``````

isaacg

4

## ES6，76个75 65 64字节

`````` a=>(f=r=>a.filter((x,i)=>a.indexOf(x,r&&i+1)==(r|i))+a)()!=f(-1)
``````

@xnor的答案的直接端口。

2
65个字节，使用以下函数：`a=>(f=r=>a.filter((x,i)=>a.indexOf(x,r&&i+1)==(r||i))+a)()!=f(-1)`
user81655，2016年

Mama Fun Roll

@ՊՓԼՃՐՊՃՈԲՍԼ不，我希望它是-1。`~`与相同`>=0`

Mama Fun Roll

@ user81655抱歉，出于某些原因，我之前没有注意到您的评论。特技，但我喜欢！

2

# 05AB1E，4 个字节

``````ÙIÚÊ
``````

@xnor的Pyth答案端口。

``````Ù       # Uniquified
IÚ     # Reversed uniquified on the input again
Ê    # Check if the two lists are not equal
``````

1

## Java，281个字符

``````class K{public static void main(String[]a){System.out.println(!k(a[0]).equals(new StringBuffer(k(new StringBuffer(a[0]).reverse().toString())).reverse().toString()));}static String k(String k){for(char i=49;i<58;i++){k=k.replaceFirst(""+i,""+(i-9)).replaceAll(""+i,"");}return k;}}
``````

1

## Python 3，90个字节

``def t(c):i,I=c.index,c[::-1].index;return any(i(n)<i(m)and I(n)<I(m)for m in c for n in c)``