Yours is good. But I have a feeling it uses more then one for/for each loop. May explain why it is a bit slower then mine. Not sure.
Yeah, also the fact that I'm iterating 2 times the same array !
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.