faster: no intermediate array