public class Main {
public static void main(String[] args) {
Stack<String> st = new Stack<>();
st.push("red");
st.push("blue");
System.out.println(st.pop());
System.out.println(st.pop());
}
}
public class Main {
public static void main(String[] args) {
Stack<String> st = new Stack<>();
st.push("red");
st.push("blue");
System.out.println(st.peek());
System.out.println(st.peek());
}
}
아래의 두 문제를 보고 사용하는법을 익혀보자.
1. https://do-hyeon.tistory.com/216?category=943920
[LeetCode] 20. Valid Parentheses
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the sam..
do-hyeon.tistory.com
2. https://do-hyeon.tistory.com/217?category=943920
[LeetCode] 71. Simplify Path
Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file..
do-hyeon.tistory.com
[Structure] Queue (First In First Out) (0) | 2021.11.07 |
---|---|
[Structure] Array (배열) (0) | 2021.10.31 |