Say i have a list

```
[1,2,2,1,3,3,3,2,3,3,1,3,3,2,3]

```

[![enter image description here](https://i.stack.imgur.com/tghx6.png)](https://i.stack.imgur.com/tghx6.png)

Any ideas how to group them (`List<KeyValuePair<int, int>>`) so that the key is the next smallest digit, and Value is next biggest digit, and if it repeats itself, group it with the same smallest key, if that makes sense...

This is the output that I am looking for:

```
[Key, Value]
[0,1]
[0,2]
[3,4]
[3,5]
[3,6]
[7,8]
[7,9]
[10,11]
[10,12]
[13,14]

```