SHARE
TWEET

Untitled

a guest Feb 16th, 2020 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public ArrayList<Integer> toEvenRevList(ArrayList<Integer> list)
  2.     {
  3.         ArrayList<Integer> newList = new ArrayList <Integer> (list);
  4.        
  5.         int temp = -1;
  6.         if (newList.size()<=1)
  7.         {
  8.             return newList;
  9.         }
  10.         else
  11.         {
  12.             if(newList.size()%2==0) {
  13.                 temp = newList.remove(newList.size()-2);
  14.             }
  15.             newList.remove(newList.size()-1);
  16.             newList = toEvenRevList(newList);
  17.             if (temp>=0)
  18.                 newList.add(temp);
  19.         }
  20.      
  21.        
  22.        
  23.         return newList;
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top