Created
May 2, 2022 16:07
-
-
Save mym0404/78ef99120722e60d4cfbacfe89c09c7f 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
import java.util.ArrayList; | |
class Main { | |
public static void main(String[] args) { | |
ArrayList<Integer> arr = new ArrayList<>(); | |
for(int i = 0; i <= 5; i++) | |
arr.add(i); | |
arr.add(6); // O(1) | |
arr.remove(arr.size() - 1); // O(1) 제일 마지막 원소를 삭제하기 때문 | |
arr.add(3, 6); | |
for(int i: arr) System.out.println(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment