added mutable array solution