Skip to content

Conversation

@suhwan2004
Copy link
Collaborator

문제

Type Info
Time Complexity O(N)
Space Complexity O(1)
Algorithm for
Data Structure x

Constraints

  • 1 <= s.length <= 1000
  • s[i] 는 무조건 '(', ')' 둘중 하나이다

Edge Case

x

풀이

  1. s의 길이만큼 for로 순회한다
  • 현재가 닫힌 괄호이고, 지금까지 순회하면서 '쌍이 없는 열린괄호'가 1개 이상이면 그걸 빼고 다음으로 넘어간다.
  • 위의 조건이 아니며, 열린 괄호이면 '쌍이 없는 열린괄호'를 1 더한다
  • 그게 아닌 닫힌 괄호라면 '쌍이 없는 닫힌괄호'를 1 더한다

어려웠던 점

X

알게된 점

X

@github-actions github-actions bot merged commit 95171d5 into main Jan 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants