added alternative array notation solution