Skip to content

Instantly share code, notes, and snippets.

View mym0404's full-sized avatar
๐Ÿ”Š
Loud your code

MJ Studio mym0404

๐Ÿ”Š
Loud your code
View GitHub Profile
T = int(input())
for _ in range(T):
s = input()
n = len(s)
open = 0
YES = True
for i in range(n):
if s[i] == '(':
T = int(input())
for _ in range(T):
s = input()
n = len(s)
stack = []
YES = True
for i in range(n):
n = int(input())
arr = list(map(int, input().split()))
stack = []
answer = [-1 for _ in range(n)]
for i in range(n):
while len(stack) and stack[-1][0] < arr[i]:
answer[stack[-1][1]] = arr[i]
n = int(input())
h = [int(input()) for _ in range(n)]
h.append(10 ** 20)
n += 1
answer = 0
stack = []
for i in range(n):
stack = [0 for _ in range(10000)]
top_index = -1
def push(n):
global top_index
top_index += 1
stack[top_index] = n
def pop():
global top_index
stack = []
stack.append(5)
stack.pop()
stack = []
stack.append(5)
stack.pop()
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) ์ œ์ผ ๋งˆ์ง€๋ง‰ ์›์†Œ๋ฅผ ์‚ญ์ œํ•˜๊ธฐ ๋•Œ๋ฌธ
#include <iostream>
#include <vector>
using namespace std;
signed main() {
vector<int> arr{0, 1, 2, 3, 4, 5};
arr.push_back(6); // O(1)
arr.pop_back(); // O(1)
arr = [0, 1, 2, 3, 4, 5]
arr.insert(3, 6) # O(N)
print(arr) # [0, 1, 2, 6, 3, 4, 5]