dp

    [Algorithm] LeetCode 63. Unique Paths 2 (java)

    [Algorithm] LeetCode 63. Unique Paths 2 (java)

    풀이 코드 class Solution { public int uniquePathsWithObstacles(int[][] obstacleGrid) { int m = obstacleGrid.length; int n = obstacleGrid[0].length; if (obstacleGrid[0][0] == 1) return 0; obstacleGrid[0][0] = 1; for (int x = 1; x    사고 과정 https://leetcode.com/problems/unique-paths-ii 앞서 풀었던 Unique Paths 1과 동일하지만, 중간에 장애물이 있다는 조건이 추가되었다.  (이전 1편에서도 중학교 수학 길찾기 문제에서..

    [Algorithm] LeetCode 62. Unique Paths (java)

    [Algorithm] LeetCode 62. Unique Paths (java)

    풀이 코드 import java.util.Arrays;class Solution { public int uniquePaths(int m, int n) { int[][] memo = new int[m][n]; for(int[] arr : memo) { Arrays.fill(arr, 1); } for(int col = 1; col   사고 과정 https://leetcode.com/problems/unique-paths/description/ 오늘은 midium 난이도 치고 상당히 쉬우면서 DP의 진가를 엿볼 수 있는 문제로 풀어보았다.  단순히 점화식만 만들면 되었던 문제..  시작하기 앞서, 다음 constraint에 주목하면 좋..