it's single passing. it's just two arrays.

generally, you are right. it's possible to eliminate the first loop.