> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/f/find_the_missing_permutation.md).

# Find the missing permutation

```ruby
func check_perm(arr) {
    var hash = Hash()
    hash.set_keys(arr...)
    arr.each { |s|
        {
            var t = (s.substr(1) + s.substr(0, 1))
            hash.has_key(t) || return t
        } * s.len
    }
}
 
var perms = %w(ABCD CABD ACDB DACB BCDA ACBD ADCB CDAB DABC BCAD CADB CDBA
               CBAD ABDC ADBC BDCA DCBA BACD BADC BDAC CBDA DBCA DCAB)
 
say check_perm(perms)
```

#### Output:

```
DBAC
```
