알고리즘(python)/자료구조
[Python]Stack 백준 10773
문제https://www.acmicpc.net/problem/10773 앞에 문제에서 스택을 구현하였기에 필요한 부분만 가져왔다.스택의 기본적인 사용을 알아보기 위한 문제인거 같다. 123456789101112131415161718192021222324252627282930313233343536import sys class Stack: def __init__(self): self.len = 0 self.list = [] def pop(self): pop_result=self.list[self.len-1] del self.list[self.len-1] self.len -= 1 return pop_result def push(self,num): self.len += 1 self.list.append(num)..
2019. 12. 14. 23:16
최근댓글