solution way is changed from list to array