<?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[Stories by Sachin Shukla on Medium]]></title>
        <description><![CDATA[Stories by Sachin Shukla on Medium]]></description>
        <link>https://medium.com/@sachinbcas05?source=rss-9a2b5b681dd3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*asf2y5ac49EaQyvv</url>
            <title>Stories by Sachin Shukla on Medium</title>
            <link>https://medium.com/@sachinbcas05?source=rss-9a2b5b681dd3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 06:31:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sachinbcas05/feed" 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 7 of LeetCode February Challenge !]]></title>
            <link>https://sachinbcas05.medium.com/day-7-of-leetcode-february-challenge-dd8ee17e0184?source=rss-9a2b5b681dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd8ee17e0184</guid>
            <dc:creator><![CDATA[Sachin Shukla]]></dc:creator>
            <pubDate>Sun, 07 Feb 2021 14:00:18 GMT</pubDate>
            <atom:updated>2021-02-07T14:00:18.301Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Day 7 of LeetCode February Challenge !</strong></p><p><strong>Shortest Distance to a Character !</strong></p><p>Given a string s and a character c that occurs in s, return <em>an array of integers </em><em>answer where</em> answer.length == s.length <em>and</em> answer[i] <em>is the shortest distance from</em> s[i] <em>to the character</em> c <em>in</em> s.</p><p><strong>Example 1:</strong></p><pre><strong>Input:</strong> s = &quot;loveleetcode&quot;, c = &quot;e&quot;<br><strong>Output:</strong> [3,2,1,0,1,0,0,1,2,2,1,0]</pre><p><strong>Example 2:</strong></p><pre><strong>Input:</strong> s = &quot;aaab&quot;, c = &quot;b&quot;<br><strong>Output:</strong> [3,2,1,0]</pre><p><strong>Constraints:</strong></p><ul><li>1 &lt;= s.length &lt;= 104</li><li>s[i] and c are lowercase English letters.</li><li>c occurs at least once in s.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9-o_43rxevfPm_t4Sf4Dw.jpeg" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ec209e8bd8d1e5a8a49cb829661d02e/href">https://medium.com/media/7ec209e8bd8d1e5a8a49cb829661d02e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd8ee17e0184" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 6 of Leetcode February Challenge !]]></title>
            <link>https://sachinbcas05.medium.com/day-6-of-leetcode-february-challenge-a64d2ec7d09d?source=rss-9a2b5b681dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a64d2ec7d09d</guid>
            <dc:creator><![CDATA[Sachin Shukla]]></dc:creator>
            <pubDate>Sat, 06 Feb 2021 08:26:57 GMT</pubDate>
            <atom:updated>2021-02-06T08:26:57.799Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Day 6 of Leetcode February Challenge !</strong></p><p>Given a binary tree, imagine yourself standing on the <em>right</em> side of it, return the values of the nodes you can see ordered from top to bottom.</p><p><strong>Example:</strong></p><pre><strong>Input:</strong> [1,2,3,null,5,null,4]<br><strong>Output:</strong> [1, 3, 4]<br><strong>Explanation:</strong></pre><pre>   1            &lt;---<br> /   \<br>2     3         &lt;---<br> \     \<br>  5     4       &lt;---</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9-o_43rxevfPm_t4Sf4Dw.jpeg" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90ee6d55b4332fc742ea5138c27818a6/href">https://medium.com/media/90ee6d55b4332fc742ea5138c27818a6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a64d2ec7d09d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 5 of Leetcode February Challenge !]]></title>
            <link>https://sachinbcas05.medium.com/day-5-of-leetcode-february-challenge-56603b8ca4d8?source=rss-9a2b5b681dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/56603b8ca4d8</guid>
            <dc:creator><![CDATA[Sachin Shukla]]></dc:creator>
            <pubDate>Sat, 06 Feb 2021 08:24:34 GMT</pubDate>
            <atom:updated>2021-02-06T08:24:34.805Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Day 5 of Leetcode February Challenge !</strong></p><p>Given a string path, which is an <strong>absolute path</strong> (starting with a slash &#39;/&#39;) to a file or directory in a Unix-style file system, convert it to the simplified <strong>canonical path</strong>.</p><p>In a Unix-style file system, a period &#39;.&#39; refers to the current directory, a double period &#39;..&#39; refers to the directory up a level, and any multiple consecutive slashes (i.e. &#39;//&#39;) are treated as a single slash &#39;/&#39;. For this problem, any other format of periods such as &#39;...&#39; are treated as file/directory names.</p><p>The <strong>canonical path</strong> should have the following format:</p><ul><li>The path starts with a single slash &#39;/&#39;.</li><li>Any two directories are separated by a single slash &#39;/&#39;.</li><li>The path does not end with a trailing &#39;/&#39;.</li><li>The path only contains the directories on the path from the root directory to the target file or directory (i.e., no period &#39;.&#39; or double period &#39;..&#39;)</li></ul><p>Return <em>the simplified </em><strong><em>canonical path</em></strong>.</p><p><strong>Example 1:</strong></p><pre><strong>Input:</strong> path = &quot;/home/&quot;<br><strong>Output:</strong> &quot;/home&quot;<br><strong>Explanation:</strong> Note that there is no trailing slash after the last directory name.</pre><p><strong>Example 2:</strong></p><pre><strong>Input:</strong> path = &quot;/../&quot;<br><strong>Output:</strong> &quot;/&quot;<br><strong>Explanation:</strong> Going one level up from the root directory is a no-op, as the root level is the highest level you can go.</pre><p><strong>Example 3:</strong></p><pre><strong>Input:</strong> path = &quot;/home//foo/&quot;<br><strong>Output:</strong> &quot;/home/foo&quot;<br><strong>Explanation: </strong>In the canonical path, multiple consecutive slashes are replaced by a single one.</pre><p><strong>Example 4:</strong></p><pre><strong>Input:</strong> path = &quot;/a/./b/../../c/&quot;<br><strong>Output:</strong> &quot;/c&quot;</pre><p><strong>Constraints:</strong></p><ul><li>1 &lt;= path.length &lt;= 3000</li><li>path consists of English letters, digits, period &#39;.&#39;, slash &#39;/&#39; or &#39;_&#39;.</li><li>path is a valid absolute Unix path.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9-o_43rxevfPm_t4Sf4Dw.jpeg" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca4ec95bd0a44807c648fe0c19a7bd26/href">https://medium.com/media/ca4ec95bd0a44807c648fe0c19a7bd26/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56603b8ca4d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 4 of LeetCode February Challenge !]]></title>
            <link>https://sachinbcas05.medium.com/day-4-of-leetcode-february-challenge-3364be2f9fe2?source=rss-9a2b5b681dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3364be2f9fe2</guid>
            <dc:creator><![CDATA[Sachin Shukla]]></dc:creator>
            <pubDate>Thu, 04 Feb 2021 15:12:28 GMT</pubDate>
            <atom:updated>2021-02-04T15:12:28.114Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Day 4 of LeetCode February Challenge !</strong></p><p><strong>Longest Harmonious Subsequence</strong></p><p>We define a harmonious array as an array where the difference between its maximum value and its minimum value is <strong>exactly</strong> 1.</p><p>Given an integer array nums, return <em>the length of its longest harmonious subsequence among all its possible subsequences</em>.</p><p>A <strong>subsequence</strong> of array is a sequence that can be derived from the array by deleting some or no elements without changing the order of the remaining elements.</p><p><strong>Example 1:</strong></p><pre><strong>Input:</strong> nums = [1,3,2,2,5,2,3,7]<br><strong>Output:</strong> 5<br><strong>Explanation:</strong> The longest harmonious subsequence is [3,2,2,2,3].</pre><p><strong>Example 2:</strong></p><pre><strong>Input:</strong> nums = [1,2,3,4]<br><strong>Output:</strong> 2</pre><p><strong>Example 3:</strong></p><pre><strong>Input:</strong> nums = [1,1,1,1]<br><strong>Output:</strong> 0</pre><p><strong>Constraints:</strong></p><ul><li>1 &lt;= nums.length &lt;= 2 * 104</li><li>-109 &lt;= nums[i] &lt;= 109</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9-o_43rxevfPm_t4Sf4Dw.jpeg" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/badc915dcb68ade9930e372390d2475d/href">https://medium.com/media/badc915dcb68ade9930e372390d2475d/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3364be2f9fe2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 3 of LeetCode February Challenge !]]></title>
            <link>https://sachinbcas05.medium.com/day-3-of-leetcode-february-challenge-e9c0c32eccba?source=rss-9a2b5b681dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9c0c32eccba</guid>
            <dc:creator><![CDATA[Sachin Shukla]]></dc:creator>
            <pubDate>Wed, 03 Feb 2021 16:00:55 GMT</pubDate>
            <atom:updated>2021-02-03T16:00:55.357Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Day 3 of LeetCode February Challenge !</strong></p><p>Given head, the head of a linked list, determine if the linked list has a cycle in it.</p><p>There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail&#39;s next pointer is connected to. <strong>Note that </strong><strong>pos is not passed as a parameter</strong>.</p><p>Return true<em> if there is a cycle in the linked list</em>. Otherwise, return false</p><p><strong>Example 1:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/0*Qd7YTpZeJET0UeXD.png" /></figure><pre><strong>Input:</strong> head = [3,2,0,-4], pos = 1<br><strong>Output:</strong> true<br><strong>Explanation:</strong> There is a cycle in the linked list, where the tail connects to the 1st node (0-indexed).</pre><p><strong>Constraints:</strong></p><ul><li>The number of the nodes in the list is in the range [0, 104].</li><li>-105 &lt;= Node.val &lt;= 105</li><li>pos is -1 or a <strong>valid index</strong> in the linked-list.</li></ul><p><strong>Follow up:</strong> Can you solve it using O(1) (i.e. constant) memory?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9-o_43rxevfPm_t4Sf4Dw.jpeg" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7aac5260b63f32fb4346adf1dfa61047/href">https://medium.com/media/7aac5260b63f32fb4346adf1dfa61047/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9c0c32eccba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 2 of Leetcode February Challenge !]]></title>
            <link>https://sachinbcas05.medium.com/day-2-of-leetcode-february-challenge-b8d46c7d4ef6?source=rss-9a2b5b681dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8d46c7d4ef6</guid>
            <dc:creator><![CDATA[Sachin Shukla]]></dc:creator>
            <pubDate>Tue, 02 Feb 2021 16:12:18 GMT</pubDate>
            <atom:updated>2021-02-02T16:12:18.772Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Day 2 of Leetcode February Challenge !</strong></p><p>Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in [low, high]. Trimming the tree should <strong>not</strong> change the relative structure of the elements that will remain in the tree (i.e., any node&#39;s descendant should remain a descendant). It can be proven that there is a <strong>unique answer</strong>.</p><p>Return <em>the root of the trimmed binary search tree</em>. Note that the root may change depending on the given bounds.</p><p><strong>Example 1:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*hbrp5IHUyCUR1xWF.jpg" /></figure><pre><strong>Input:</strong> root = [1,0,2], low = 1, high = 2<br><strong>Output:</strong> [1,null,2]</pre><p><strong>Example 2:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*PEiFxo8VdcOAz1ar.jpg" /></figure><pre><strong>Input:</strong> root = [3,0,4,null,2,null,null,1], low = 1, high = 3<br><strong>Output:</strong> [3,2,null,1]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFHl1oYU172x7BIL4T1naQ.jpeg" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f71f461f483e11727ac25f490b293a7/href">https://medium.com/media/6f71f461f483e11727ac25f490b293a7/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8d46c7d4ef6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 1 of LeetCode February Challenge]]></title>
            <link>https://sachinbcas05.medium.com/day-1-of-leetcode-february-challenge-9fb799d04630?source=rss-9a2b5b681dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fb799d04630</guid>
            <category><![CDATA[leetcode-easy]]></category>
            <category><![CDATA[leetcode-solution]]></category>
            <category><![CDATA[leetcode-challenge]]></category>
            <category><![CDATA[30-day-leetcode-challenge]]></category>
            <dc:creator><![CDATA[Sachin Shukla]]></dc:creator>
            <pubDate>Mon, 01 Feb 2021 21:22:09 GMT</pubDate>
            <atom:updated>2021-02-01T21:22:09.063Z</atom:updated>
            <content:encoded><![CDATA[<p>Write a function that takes an unsigned integer and returns the number of ‘1’ bits it has (also known as the <a href="http://en.wikipedia.org/wiki/Hamming_weight">Hamming weight</a>).</p><p><strong>Note:</strong></p><ul><li>Note that in some languages such as Java, there is no unsigned integer type. In this case, the input will be given as a signed integer type. It should not affect your implementation, as the integer’s internal binary representation is the same, whether it is signed or unsigned.</li><li>In Java, the compiler represents the signed integers using 2’s <a href="https://en.wikipedia.org/wiki/Two%27s_complement">complement notation</a>. Therefore, in <strong>Example 3</strong> above, the input represents the signed integer. -3.</li></ul><p><strong>Follow up</strong>: If this function is called many times, how would you optimize it?</p><p><strong>Example 1:</strong></p><pre><strong>Input:</strong> n = 00000000000000000000000000001011<br><strong>Output:</strong> 3<br><strong>Explanation:</strong> The input binary string <strong>00000000000000000000000000001011</strong> has a total of three &#39;1&#39; bits.</pre><p><strong>Example 2:</strong></p><pre><strong>Input:</strong> n = 00000000000000000000000010000000<br><strong>Output:</strong> 1<br><strong>Explanation:</strong> The input binary string <strong>00000000000000000000000010000000</strong> has a total of one &#39;1&#39; bit.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFHl1oYU172x7BIL4T1naQ.jpeg" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7797859c611018db044c0b232b86a5f7/href">https://medium.com/media/7797859c611018db044c0b232b86a5f7/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fb799d04630" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>