Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void switchPairs(Stack<Integer> actual) {
- for(int i = 0; i < actual.size()-1; i+=2) {
- int temp = actual.get(i);
- actual.set(i, actual.get(i+1));
- actual.set(i+1, temp);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement