Created
May 22, 2022 00:11
-
-
Save PythonCoderAS/8faf0ca26797e0419fc0115a7d63cffc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void interleave(ArrayList<Integer> a1, ArrayList<Integer> a2){ | |
| Iterator<Integer> it2 = a2.iterator(); | |
| int idx = 0; | |
| while (it2.hasnext()){ | |
| idx++; | |
| if (idx < a1.size()){ | |
| a1.add(idx, it2.next()); | |
| } else { | |
| a1.add(it2.next()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment