added reverse array solution