백준 1406 에디터 파이썬
문제 풀이 첫 번째 시도 for _ in range(M): t = list(map(str, sys.stdin.readline())) if t[0] == 'L' and cursor != 0: cursor -= 1 elif t[0] == 'D' and cursor != len(N): cursor += 1 elif t[0] == 'B' and cursor != 0: del N[cursor - 1] cursor -= 1 elif t[0] == 'P': N.insert(cursor, t[2]) cursor += 1 시간 초과가 나왔다. insert와 del을 썼는데, 시간복잡도가 O(n)이어서 그런 것 같았다. 두 번째 시도 시간복잡도 O(1)인 append, pop을 써서 다시 시도! 커서를 옮길 때 curso..