-
-
Notifications
You must be signed in to change notification settings - Fork 245
[sonjh1217] WEEK 06 solutions #1864
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
Conversation
@@ -0,0 +1,27 @@ | |||
class Solution { | |||
func maxArea(_ height: [Int]) -> Int { | |||
var heights = height |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드가 깔끔하고 좋네요 👍 height를 안쓰고, heights를 새로 만들어서 쓰시는 이유가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func maxArea(_ height: [Int]) -> Int { 라인은 leetCode에서 자동생성된건데.. 제가 습관이 되어서 Collection 타입들은 s가 붙어야 Collection으로 읽혀서요ㅎㅎ Swift에서 권장되는 방식입니답!
node.isEndOfWord = true | ||
} | ||
|
||
// O(m) ~ O(26^m) time / O(1) space |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공간복잡도가 왜 O(1)이라고 생각하셨는지 여쭤봐도 될까요?? word의 길이만큼 공간이 필요하지 않나요..? 제가 잘 몰라서 여쭤봅니다..!!! 코드가 엄청 깔끔하고 좋네요 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e90ae4f 와 감사합니다! Array(word)며 재귀 스택 쌓이는거며 다 O(m)인데.. 왜 저렇게 생각했는지 모르겠네요ㅠ 아직 재귀에 대해서 잘 파악을 못해서 그랬던 것 같아요. 감사합니답!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!