check matching arrays with similar elements