Reverse Array Problem Leetcode Sql Queries