solve the array problem