@leo-b Looks like you do not use values in $seen array,  it would be more descriptive to set them to `true` instead of `1`.