You are viewing a single comment's thread. Return to all comments →
public static List<Integer> reverseArray(List<Integer> toReversList) { if(toReversList.isEmpty()) return Collections.empty(); List<Integer> reversed = new ArrayList<>(); for(int i = toReversList.size() -1; i >= 0; i--){ reversed.add(toReversList.get(i)); } return reversed; } return list;
}
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Arrays - DS
You are viewing a single comment's thread. Return to all comments →
}