common elements in sorted arrays and squeeze matrix