Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

[서폿] 2021年10月03日 #373

Merged
mergify merged 1 commit into main from keeprainy-1003
Oct 11, 2021
Merged

[서폿] 2021年10月03日 #373

mergify merged 1 commit into main from keeprainy-1003
Oct 11, 2021

Conversation

@ghost
Copy link

@ghost ghost commented Oct 3, 2021

📌 푼 문제들


📝 간단한 풀이 과정

20. Valid Parentheses

  • (), [], {} 맞추어서 스택을 사용했습니다

128. Longest Consecutive Sequence

  • Python3 의 set 이 hastset 으로 구현되어있어 이를 활용했습니다
  • Consecutive Sequence 의 first element 를 찾기위해 현재 element 의 -1 한 값이 set 에 있는지 확인했습니다

55. Jump Game

  • 솔직히 말해서 Discussion 참고했습니다...
  • DP 를 활용했습니다

377. Combination Sum IV

  • 처음에 재귀로 풀었다 시간초과났습니다
  • target 이 1 이상 1000 이하이므로 이를 DP 로 활용했습니다

Copy link
Member

@bsm8734 bsm8734 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

# Square bracket []
# Curly bracket {}
# Parentheses ()
pair = {')': '(', '}': '{', ']': '['}
Copy link
Member

@bsm8734 bsm8734 Oct 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 방법이 있네요! 배워갑니다!

Copy link
Member

@CoodingPenguin CoodingPenguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

Comment on lines +18 to +20
for num in nums:
if num <= target:
dp[num] += 1
Copy link
Member

@CoodingPenguin CoodingPenguin Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자기 자신에 대한 건 미리 해주셨네용! 저는 if문으로 검사해줬는데 이렇게 해도 괜찮을 것 같네용!

Comment on lines +26 to +27
if not st or st[-1] != pair[b]:
return False
Copy link
Member

@CoodingPenguin CoodingPenguin Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오.. 일치하지 않으면 false니까 바로 리턴해도 되네용. 저는 나중에 스택에 남는 거 여부를 검사했는데 이렇게 하는게 훨씬 빠른 것 같아용!

Copy link
Contributor

@opijae opijae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

역시..! 고생하셨습니다!

@mergify mergify bot merged commit 285c564 into main Oct 11, 2021
@mergify mergify bot deleted the keeprainy-1003 branch October 11, 2021 14:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /