Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1406번 에디터 #18

Merged
merged 2 commits into from
Sep 7, 2022
Merged

1406번 에디터 #18

merged 2 commits into from
Sep 7, 2022

Conversation

NamJwong
Copy link
Member

@NamJwong NamJwong commented Sep 7, 2022

문제

풀이 후기

명령어마다 string을 변경해주는 방법으로 했다가 시간 초과가 났다
아마 slice의 시간복잡도가 O(n)인 것 때문인 것 같다

도저히 시간복잡도를 줄일 방법을 모르겠어서 서치를 해서 cursor를 기준으로 양 쪽에 스택을 두고 푸는 방법이 있다는 것을 알게 되어 그대로 구현했다.

스택의 push pop 연산이 O(1)이기 때문에 이 문제에서 활용할 수 있었다.
스스로 생각해내지 못해 안타깝지만 그래도 스택을 이렇게도 활용할 수 있다는 것을 알게 된 것에 의미를 두자!

@NamJwong NamJwong self-assigned this Sep 7, 2022
@NamJwong NamJwong merged commit e0f8ad0 into main Sep 7, 2022
@NamJwong NamJwong deleted the algorithm/#17 branch September 7, 2022 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1406번 에디터
1 participant