-
-
Notifications
You must be signed in to change notification settings - Fork 195
[soobing] WEEK09 Solutions #1525
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
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.
이번 주도 고생 많으셨습니다! 다음주도 화이팅이에요!!
* - 매 index마다, 현재까지 max 곱, min 곱을 찾고 최대값을 갱신 | ||
*/ | ||
function maxProduct(nums: number[]): number { | ||
let maxSoFar = nums[0]; |
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.
모든 경우를 한 번에 고려하는 깔끔한 접근입니다 👍
초기에 빈 배열 예외처리가 있으면 더 좋을것 같아요!
* - 비가 내렸을 때, 태평양과 대서양 모두로 물이 흐를 수 있는 지점을 찾아 반환하는 문제입니다. | ||
* 아이디어 | ||
* 1) BFS/DFS | ||
* - 각 바다에서 역방향으로 물이 도달할 수 있는 셀을 탐색한 후, 두 바다 모두에 도달 가능한 셀의 교집합 구하기 |
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.
안녕하세요!
요 문제를 반대로 바다에서 부터 시작하는 방식으로 접근해 풀이해 보셨군요...!
저는 모든 셀에 대해서 양 바다로 모두 닿을 수 있는지 여부를 판단하려고 모든 셀 * 2 번씩 dfs 를 돌렸었는데
이런 아이디어를 떠올리게 된 뭐랄까요 생각의 과정..? 를 간단히 설명해주실 수 있을까요!?
(어떤 부분을 보고 이렇게 접근해볼 수도 있겠다.. 라는 식의 느낌입니다 🤣 뭔가 콕찝어서 설명을 못하겠네요ㅠ)
+) 알고리즘 문제를 풀이하실 때 풀이 아이디어를 떠올리시는 포인트? 같은것도 만약 있으시다면 알려주시면 감사히 배워가겠습니다!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!