• + 1 comment

    there is two solutions with different times Space and Time.

     public static List<Integer> reverseArray(List<Integer> list) {
         //two pointers technique
         int left = 0, right = list.size() - 1;
    
         while(left < right) {
             int tempValue = list.get(left);
             list.set(left, list.get(right));
             list.set(right, tempValue);
    
             left++;
             right--;
         }
       return list;
    }