<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[100-days-of-leetcode - Medium]]></title>
        <description><![CDATA[I am solving questions on leetcode. Join me!! - Medium]]></description>
        <link>https://medium.com/100-days-of-leetcode?source=rss----f40d6d6b3134---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>100-days-of-leetcode - Medium</title>
            <link>https://medium.com/100-days-of-leetcode?source=rss----f40d6d6b3134---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 09:09:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/100-days-of-leetcode" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Day 34 — Unique Paths II]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-34-unique-paths-ii-6f4bcb324e43?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/6f4bcb324e43</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[100daychallenge]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 18:02:13 GMT</pubDate>
            <atom:updated>2020-03-26T18:02:13.181Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 34 — Unique Paths II</h3><h4><a href="https://leetcode.com/problems/unique-paths-ii/">https://leetcode.com/problems/unique-paths-ii/</a></h4><pre>class Solution {<br>    public int uniquePathsWithObstacles(int[][] obstacleGrid) {<br>        <br>        int m = obstacleGrid.length;<br>        int n = obstacleGrid[0].length;<br>        int[][] pathCount = new int[m][n];<br>        pathCount[0][0] = obstacleGrid[0][0] == 1 ? 0 : 1;<br>        <br>        for(int i = 1; i &lt; n; i++) {<br>             pathCount[0][i] = <br>                 obstacleGrid[0][i] == 0 ?<br>                 pathCount[0][i-1] : 0;<br>        }<br>        <br>        for(int i = 1; i &lt; m; i++){<br>            if(obstacleGrid[i][0] == 0) {<br>                pathCount[i][0] = pathCount[i-1][0];<br>            } else {<br>                pathCount[i][0] = 0;<br>            }<br>        }<br>        <br>        for(int i = 1; i &lt; m; i++) {<br>            for(int j = 1; j &lt; n; j++) {<br>                if(obstacleGrid[i][j] == 1) {<br>                    pathCount[i][j] =0;<br>                    continue;<br>                }<br>                if(obstacleGrid[i-1][j] == 0){<br>                    pathCount[i][j] += pathCount[i-1][j];<br>                }<br>                 if(obstacleGrid[i][j-1] == 0){<br>                    pathCount[i][j] += pathCount[i][j-1];<br>                }<br>            }    <br>        }<br>        return pathCount[m-1][n-1];<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f4bcb324e43" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-34-unique-paths-ii-6f4bcb324e43">Day 34 — Unique Paths II</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 33–01 Matrix (Medium)]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-33-01-matrix-medium-35afe343087d?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/35afe343087d</guid>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[100daychallenge]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 04:10:57 GMT</pubDate>
            <atom:updated>2020-03-25T04:10:57.503Z</atom:updated>
            <content:encoded><![CDATA[<h4><a href="https://leetcode.com/problems/01-matrix/">https://leetcode.com/problems/01-matrix/</a></h4><pre>class Solution {<br>    public int[][] updateMatrix(int[][] matrix) {<br>        <br>        if(matrix == null <br>           || matrix.length == 0 <br>           || matrix[0].length == 0) <br>            return matrix;<br>        int m = matrix.length;<br>        int n = matrix[0].length;<br>        int[][] dist = new int[m][n];<br>        for(int[] a : dist) {<br>            Arrays.fill(a, 10001);<br>        }<br>        for(int i = 0; i &lt; m; i++) {<br>            for(int j = 0; j&lt; n; j++) {<br>                if(matrix[i][j] == 0) {<br>                    dist[i][j] = 0;<br>                } else {<br>                    if(i &gt; 0) {<br>                        dist[i][j] = <br>                            Math.min(dist[i-1][j] + 1, <br>                                     dist[i][j]);<br>                    }<br>                    if(j &gt; 0) {<br>                        dist[i][j] = <br>                        Math.min(dist[i][j-1] + 1, <br>                                 dist[i][j]);<br>                    }<br>                }<br>            }<br>        }<br>        <br>        for(int i = m-1; i &gt;= 0; i--) {<br>            for(int j = n-1; j &gt;= 0; j--) {<br>                if(i &lt; m-1) {<br>                    dist[i][j] = <br>                        Math.min(dist[i+1][j] + 1, <br>                                 dist[i][j]);<br>                }<br>                if(j &lt; n-1){<br>                    dist[i][j] = <br>                        Math.min(dist[i][j+1] + 1, <br>                                 dist[i][j]);<br>                }<br>            }<br>        }<br>        return dist;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35afe343087d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-33-01-matrix-medium-35afe343087d">Day 33–01 Matrix (Medium)</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 32 — Palindromic Substrings]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-32-palindromic-substrings-755f23ce64cd?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/755f23ce64cd</guid>
            <category><![CDATA[string]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[palindrome]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 00:39:29 GMT</pubDate>
            <atom:updated>2020-03-25T00:39:29.552Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 32 — Palindromic Substrings</h3><h4><a href="https://leetcode.com/problems/palindromic-substrings/submissions/">https://leetcode.com/problems/palindromic-substrings/</a></h4><p>Solution 1</p><pre>class Solution {<br>    public int countSubstrings(String s) {<br>        <br>        int n = s.length();<br>        int ans = n;<br>        char[] charArr = s.toCharArray();<br>        for(int i=1; i &lt; n; i++) {<br>            ans += getCount(charArr, i, i);<br>            if(charArr[i-1] == charArr[i]) {            <br>                ans = ans + 1 + getCount(charArr, i-2, i+1);<br>            }          <br>        }<br>        return ans;<br>    }<br>    private int getCount(char[] charArr, <br>                         int left, int right){<br>        int count = 0;<br>        int n = charArr.length;<br>        while(left &gt;= 0 &amp;&amp; right &lt; n <br>              &amp;&amp; charArr[left] == charArr[right]) {<br>            count ++;<br>            left --;<br>            right ++;<br>        }<br>        return count;<br>    }<br>}</pre><p>Solution 2</p><pre>class Solution {<br>    public int countSubstrings(String s) {<br>        <br>        int n = s.length();<br>        int ans = 0;<br>        char[] charArr = s.toCharArray();<br>        for(int i=0; i &lt; n; i++) {<br>            ans += getCount(charArr, i, i);<br>            ans += getCount(charArr, i-1, i);<br>        }<br>        return ans;<br>    }<br>    private int getCount(char[] charArr,<br>                         int left, int right){<br>        int count = 0;<br>        int n = charArr.length;<br>        while(left &gt;= 0 &amp;&amp; right &lt; n <br>              &amp;&amp; charArr[left] == charArr[right]) {<br>            count ++;<br>            left --;<br>            right ++;<br>        }<br>        return count;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=755f23ce64cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-32-palindromic-substrings-755f23ce64cd">Day 32 — Palindromic Substrings</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 31 — Longest Common Subsequence]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-31-longest-common-subsequence-928a4390eae?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/928a4390eae</guid>
            <category><![CDATA[leetcode-medium]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[100daysofcode]]></category>
            <category><![CDATA[100daychallenge]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Tue, 24 Mar 2020 23:53:03 GMT</pubDate>
            <atom:updated>2020-03-24T23:53:03.160Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 31 — Longest Common Subsequence</h3><h4><a href="https://leetcode.com/problems/longest-common-subsequence/">https://leetcode.com/problems/longest-common-subsequence/</a></h4><pre>class Solution {<br>   public int longestCommonSubsequence(String text1, String text2) {<br>        int n = text1.length();<br>        int m = text2.length();<br>        char[] st1 = text1.toCharArray();<br>        char[] st2 = text2.toCharArray();<br>        int[][] dp = new int[n+1][m+1]; <br>        for (int i = 1; i &lt;= n; ++i) {<br>            for (int j = 1; j &lt;= m; ++j) {<br>                if (st1[i-1] == st2[j-1]) {<br>                    dp[i][j] = dp[i-1][j-1] + 1;<br>                } else {<br>                    dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);<br>                }<br>            }<br>        }<br>        return dp[n][m];<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=928a4390eae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-31-longest-common-subsequence-928a4390eae">Day 31 — Longest Common Subsequence</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 30 — Last Stone Weight]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-30-last-stone-weight-49520c6767d1?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/49520c6767d1</guid>
            <category><![CDATA[priority-queue]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[leetcode-easy]]></category>
            <category><![CDATA[100daychallenge]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Tue, 24 Mar 2020 22:41:36 GMT</pubDate>
            <atom:updated>2020-03-24T22:41:35.947Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 30 — Last Stone Weight</h3><h4><a href="https://leetcode.com/problems/last-stone-weight/">https://leetcode.com/problems/last-stone-weight/</a></h4><pre>class Solution {<br>    public int lastStoneWeight(int[] stones) {<br>        if(stones == null <br>           || stones.length == 0) return 0;<br>        PriorityQueue&lt;Integer&gt; pq <br>            = new PriorityQueue&lt;&gt;((a,b)-&gt; b-a);<br>        for(int stone: stones) {<br>            pq.offer(stone);<br>        }<br>        while(!pq.isEmpty()) {<br>            int s1 = pq.poll();<br>            if(!pq.isEmpty()){<br>                int s2 = pq.poll();<br>                if (s1 &gt; s2) pq.offer(s1 - s2);<br>            } else {<br>                return s1;<br>            }<br>        }<br>        return 0;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49520c6767d1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-30-last-stone-weight-49520c6767d1">Day 30 — Last Stone Weight</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 29 -Minimum Falling Path Sum II]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-29-minimum-falling-path-sum-ii-894ebe519609?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/894ebe519609</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[leetcode-hard]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Sat, 21 Mar 2020 00:43:31 GMT</pubDate>
            <atom:updated>2020-03-21T00:43:31.330Z</atom:updated>
            <content:encoded><![CDATA[<h4><a href="https://leetcode.com/problems/minimum-falling-path-sum-ii/">https://leetcode.com/problems/minimum-falling-path-sum-ii/</a></h4><pre>class Solution {<br>    public int minFallingPathSum(int[][] arr) {<br>        if (arr == null <br>            || arr.length == 0 <br>            || arr[0].length == 0) <br>            return 0;<br>        <br>        int n = arr.length;<br>        <br>        int min1, min2, minCol = 0;<br>        for (int i = n - 2; i &gt;= 0; i--) {<br>            min1 = Integer.MAX_VALUE;<br>            min2 = Integer.MAX_VALUE;<br>            <br>            for (int j = 0; j &lt; n; j++) {<br>                if (arr[i + 1][j] &lt; min1) {<br>                    min2 = min1;<br>                    min1 = arr[i + 1][j];<br>                    minCol = j;<br>                } else if (arr[i + 1][j] &lt; min2) {<br>                    min2 = arr[i + 1][j];<br>                }<br>            }<br>            <br>            for (int j = 0; j &lt; n; j++) {<br>                if (j == minCol) arr[i][j] += min2;<br>                else arr[i][j] += min1;<br>            }<br>        }<br>        <br>        int result = Integer.MAX_VALUE;<br>        for (int i = 0; i &lt; n; i++) {<br>           result = Math.min(result, arr[0][i]);<br>        }<br>        <br>        return result;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=894ebe519609" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-29-minimum-falling-path-sum-ii-894ebe519609">Day 29 -Minimum Falling Path Sum II</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 28 — Minimum Falling Path Sum]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-28-minimum-falling-path-sum-31210c94f08b?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/31210c94f08b</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Fri, 20 Mar 2020 03:12:06 GMT</pubDate>
            <atom:updated>2020-03-20T03:12:06.559Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 28 — Minimum Falling Path Sum</h3><h4><a href="https://leetcode.com/problems/minimum-falling-path-sum/">https://leetcode.com/problems/minimum-falling-path-sum/</a></h4><pre>class MinFallingPathSum{<br>    public int minFallingPathSumMethod(int[][] A) {<br>        <br>        if(A == null || A.length == 0 || A[0].length == 0) return 0;<br>        int n = A.length;<br>        for(int i = 1; i &lt; n; i++) {<br>            for(int j = 0; j &lt; n; j++) {<br>                int min = A[i-1][j];<br>                if(j &gt; 0) min = Math.min(min, A[i-1][j-1]);<br>                if(j &lt; n-1) min = Math.min(min, A[i-1][j+1]);<br>                A[i][j] += min;<br>            }<br>        }<br>        int result = Integer.MAX_VALUE;<br>        for(int i : A[n-1]) {<br>            result = Math.min(i, result);<br>        }<br>        return result;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31210c94f08b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-28-minimum-falling-path-sum-31210c94f08b">Day 28 — Minimum Falling Path Sum</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 27 — Unique Paths III]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-27-unique-paths-iii-779d23c5b885?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/779d23c5b885</guid>
            <category><![CDATA[leetcode-hard]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dfs]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Thu, 19 Mar 2020 02:41:12 GMT</pubDate>
            <atom:updated>2020-03-19T02:41:12.852Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 27 — Unique Paths III</h3><h4><a href="https://leetcode.com/problems/unique-paths-iii/">https://leetcode.com/problems/unique-paths-iii/</a></h4><pre>class Solution {<br>        int rows = 0;<br>        int cols = 0;<br>        int count_zero = 0;<br>    public int uniquePathsIII(int[][] grid) {<br>        <br>        if(grid == null || grid.length == 0 || grid[0].length == 0) <br>            return 0;<br>        int[] result = new int[1];<br>        rows = grid.length;<br>        cols = grid[0].length;<br>        <br>        int start_i = 0, start_j = 0;<br>        for(int i=0; i &lt; rows; i++){<br>            for(int j=0; j&lt; cols; j++){<br>                if(grid[i][j] == 0) count_zero++;<br>                if(grid[i][j] == 1){<br>                    start_i = i;<br>                    start_j = j;<br>                }<br>            }<br>        }<br>        <br>        dfs(grid, start_i, start_j, 0, result);<br>        return result[0];<br>    }<br>    <br>    private void dfs(int[][] grid, int i, int j,  <br>                     int curr, int[] result) {<br>        <br>        if(i &lt; 0 || i &gt;= rows <br>           || j &lt; 0 || j &gt;= cols <br>           || grid[i][j] &lt; 0) return;<br>        <br>        if(grid[i][j] == 1 &amp;&amp; curr &gt; 0) return;<br>        <br>        if( grid[i][j] == 2 ){<br>            if(curr == count_zero)<br>                result[0]++;<br>            return;<br>        }<br>        if(grid[i][j] == 0){<br>            grid[i][j] = -2;<br>            curr++;<br>        }<br>            <br>        dfs(grid, i+1, j, curr, result );<br>        dfs(grid, i-1, j, curr, result  );<br>        dfs(grid, i, j+1, curr, result );<br>        dfs(grid, i, j-1, curr, result );<br>        if(grid[i][j] == -2){<br>            grid[i][j] = 0;<br>            curr--;<br>        }<br>        return;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=779d23c5b885" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-27-unique-paths-iii-779d23c5b885">Day 27 — Unique Paths III</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 26 — Unique Paths]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-26-unique-paths-8ca1e719ac70?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/8ca1e719ac70</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[100daysofcode]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Wed, 18 Mar 2020 04:51:53 GMT</pubDate>
            <atom:updated>2020-03-18T04:51:53.407Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 26 — Unique Paths</h3><h4><a href="https://leetcode.com/problems/unique-paths/">https://leetcode.com/problems/unique-paths/</a></h4><pre>class Solution {<br>    public int uniquePaths(int m, int n) {<br>        if(m == 0 || n == 0) return 0;<br>        int[][] grid = new int[m][n];<br>        //fill all cells with 1. This will eventually be updated<br>        for(int[] ar: grid) {<br>            Arrays.fill(ar, 1);<br>        }<br>        <br>        for(int i = 1 ; i &lt; m; i++){<br>            for(int j = 1 ; j &lt; n ; j++) {<br>                grid[i][j] = grid[i-1][j] + grid [i][j-1];<br>            }<br>        }<br>        return grid[m-1][n-1];<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ca1e719ac70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-26-unique-paths-8ca1e719ac70">Day 26 — Unique Paths</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 25 — Min Cost Climbing Stairs]]></title>
            <link>https://medium.com/100-days-of-leetcode/day-25-min-cost-climbing-stairs-512d3057f42d?source=rss----f40d6d6b3134---4</link>
            <guid isPermaLink="false">https://medium.com/p/512d3057f42d</guid>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[leetcode-easy]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[arrays]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Tue, 17 Mar 2020 02:12:04 GMT</pubDate>
            <atom:updated>2020-03-17T02:12:04.159Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 25 — Min Cost Climbing Stairs</h3><h4><a href="https://leetcode.com/problems/min-cost-climbing-stairs/">https://leetcode.com/problems/min-cost-climbing-stairs/</a></h4><pre>class Solution {<br>    public int minCostClimbingStairs(int[] cost) {<br>        if(cost == null) return 0;<br>        if(cost.length ==1 ) return cost[0];        <br>        int t0 = cost[0];<br>        int t1 = cost[1];<br>        <br>        for(int i=2; i &lt; cost.length ; i++ ) {<br>            int t2 = Math.min(t0, t1) +cost[i];<br>            t0=t1;<br>            t1=t2;<br>        }<br>        return Math.min(t0, t1);<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=512d3057f42d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/100-days-of-leetcode/day-25-min-cost-climbing-stairs-512d3057f42d">Day 25 — Min Cost Climbing Stairs</a> was originally published in <a href="https://medium.com/100-days-of-leetcode">100-days-of-leetcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>