본문 바로가기
공부/algorithm

[codility] Nesting

by 밍미 2019. 12. 20.
Nesting

Nesting

Determine whether a given string of parentheses (single type) is properly nested.

Task Score

100%

Correctness

100%

Performance

100%


 

Brackets랑 다른게 뭔데 ㅠ

똑같이 풀어도 똑같이 100퍼 나오는거 뭔데ㅠ..

그냥 if문 조건만 if(A){} if(B){}에서 if(A||B){}로만 바꿨다..ㅎ

 

 

는 너무 찝찝해서 스택안쓰고도 한 번 풀어봤다.

 

 

스택 넣었다뺐다 하는걸 카운트로 넣었다뺐다 하는 것으로 변경했다.

뭐 어떤 클래스를 사용했느냐가 다를 뿐

점수도같고 복잡도도 같게 나왔다.

'공부 > algorithm' 카테고리의 다른 글

[codility] Dominator  (0) 2020.01.06
[codility] StoneWall  (0) 2019.12.22
[codility] Fish  (0) 2019.12.12
[codility] Brackets  (0) 2019.12.11
[LeetCode] #4 Median of Two Sorted Arrays  (0) 2019.12.08

댓글