posting: 동적계획법 풀이 - #77
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds JavaScript solutions for LeetCode problems (Number of Islands and Unique Paths) and a comprehensive study note on SQLD Chapter 1. The reviewer provided valuable feedback, including adding safety checks for empty inputs in the island-counting algorithm, addressing potential integer overflow and stack overflow issues in the unique paths factorial calculation, and correcting several typographical errors in the SQLD study notes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| let result = 0; | ||
| const end_row = grid.length; | ||
| const end_col = grid[0].length; |
There was a problem hiding this comment.
입력 grid가 빈 배열이거나 null/undefined인 경우, grid[0]에 접근할 때 TypeError가 발생할 수 있습니다. 실제 서비스 환경이나 견고한 코드를 위해 예외 처리를 추가하는 것이 좋습니다.
| let result = 0; | |
| const end_row = grid.length; | |
| const end_col = grid[0].length; | |
| if (!grid || grid.length === 0 || grid[0].length === 0) { | |
| return 0; | |
| } | |
| let result = 0; | |
| const end_row = grid.length; | |
| const end_col = grid[0].length; |
| const factorial = (num) => { | ||
| if (num <= 1) { | ||
| return 1; | ||
| } | ||
| return num * factorial(num - 1); | ||
| }; | ||
|
|
||
| return factorial(m + n - 2) / (factorial(n - 1) * factorial(m - 1)); |
There was a problem hiding this comment.
제약 조건에 따르면 171! 이상은 Infinity로 표현되기 때문에, factorial(198) 호출 시 Infinity가 반환되어 최종 결과가 NaN이 됩니다. 또한 재귀 호출로 인해 스택 오버플로우 위험이 있습니다.\n\n조합(Combination)을 계산할 때 곱셈과 나눗셈을 번갈아 수행하는 반복문 방식을 사용하면 오버플로우를 방지하고 시간/공간 복잡도를
| const factorial = (num) => { | |
| if (num <= 1) { | |
| return 1; | |
| } | |
| return num * factorial(num - 1); | |
| }; | |
| return factorial(m + n - 2) / (factorial(n - 1) * factorial(m - 1)); | |
| let ans = 1; | |
| const k = Math.min(m - 1, n - 1); | |
| for (let i = 1; i <= k; i++) { | |
| ans = (ans * (m + n - 2 - k + i)) / i; | |
| } | |
| return Math.round(ans); |
| - 관점에 따라 다르게 해석되지 않고 모호함이 없어야함 | ||
| - 모델링시 유의사항 | ||
| - 중복최소화 : DB 여러곳에 같은 정보를 중복하여 저장하지 않아야함 | ||
| - 비유연성 최소화 : 데이터의 정의와 테이터의 사용 프로세스를 분리하여 데이터, 프로세스의 변화가 프로그램과 DB에 미치는 영향 최소화 해야함 |
|
|
||
| ### 속성 개념 | ||
|
|
||
| - 엔터티에 대한 자세하고 구체적인 정보, 엔티의 하위요소 |
| ### 속성 값 | ||
|
|
||
| - 속성이 가질 수 있는 특정 값 | ||
| - 속성값이 으미적으로 다중 값을 포함할때, 1차 정규화 진행 |
|
|
||
| - 유일성 : 각 엔터티 인스턴스를 유일하게 구별 | ||
| - 최소성 : 최소성을 보장하면서 최소 개수의 속성 | ||
| - 붋변성 : 속성값이 최초 생성시 부여된 값에서 변하면안됨 |
PR전 코드 퀄리티 체크하기
작업내용
🔍 가독성 (Readability) CHECK
명명 규칙
const ANIMATION_DELAY_MS = 300형태로 의미 있는 이름 사용const isValidUser = user.age >= 18 && user.isVerifieduserData→authenticatedUser,list→activeUserList구조 및 구성
추상화 및 분리
AuthGuard컴포넌트ViewerSubmitButton,AdminSubmitButton로 역할별 분리🎯 예측 가능성 (Predictability) CHECK
반환 타입 일관성
UseQueryResult<T, Error>일관 사용{ ok: boolean; reason?: string }형태 일관 사용단일 책임 원칙
fetchBalance()가 로깅 등 부수효과 없이 balance만 반환명확한 명명
http.get()→httpService.getWithAuth()useModal()→useConfirmationModal()🔗 응집도 (Cohesion) CHECK
도메인별 구성
domains/user/,domains/product/폼 응집도
⚡ 결합도 (Coupling) CHECK
상태 관리 범위
useCardIdQueryParam()같은 focused hook 사용Props Drilling 제거
추상화 수준
📋 추가 CHECK
성능 고려사항
useCallback,useMemo적절 사용타입 안정성
테스트 가능성
문서화
🎨 코드 스타일 CHECK