Solve array convert problem with two approaches.