reverse array solution