<?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 kunalkrishna85 on Medium]]></title>
        <description><![CDATA[Stories by kunalkrishna85 on Medium]]></description>
        <link>https://medium.com/@kunalkrishna85?source=rss-89d464e7f1b1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*nQw-AXITTs1kwaBH</url>
            <title>Stories by kunalkrishna85 on Medium</title>
            <link>https://medium.com/@kunalkrishna85?source=rss-89d464e7f1b1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 08:25:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kunalkrishna85/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[Parent Delegation Model]]></title>
            <link>https://medium.com/@kunalkrishna85/parent-delegation-model-bec08f2120d7?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/bec08f2120d7</guid>
            <category><![CDATA[classnotfoundexception]]></category>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[jvm-class-loader]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[jvm-architecture]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Sat, 25 Jul 2026 06:22:09 GMT</pubDate>
            <atom:updated>2026-07-25T06:22:09.838Z</atom:updated>
            <content:encoded><![CDATA[<p>Key model to understand JVM architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*asoxW2QnXqKf8AqpQc6mww.png" /><figcaption>Java Class Loaders — Delegation Hierarchy Principle</figcaption></figure><p>To see classes present in lib/modules :</p><ol><li>open cmd in any director other than location of modules, say `D:`</li><li>execute D:\&gt; “C:\Program Files\Java\jdk-17\bin\jimage.exe” extract — dir C:\extracted_modules “C:\Program Files\Java\jdk-17\lib\modules”</li></ol><pre>[lib/modules]<br>   │<br>   ├──&gt; java.base module ──────────────&gt; Loaded by: Bootstrap ClassLoader<br>   │<br>   ├──&gt; java.sql module ┐<br>   ├──&gt; java.xml module ├──────────────&gt; Loaded by: Platform ClassLoader<br>   └──&gt; java.rmi module ┘</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bec08f2120d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Circular Array Traversal]]></title>
            <link>https://medium.com/@kunalkrishna85/circular-array-traversal-2ff9372f3bc4?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ff9372f3bc4</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[circular-array]]></category>
            <category><![CDATA[java-dsa]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 06:15:49 GMT</pubDate>
            <atom:updated>2026-02-06T06:23:58.195Z</atom:updated>
            <content:encoded><![CDATA[<p>How double modulo formula to traverse an array in circular manner ? In this article I try to explain using tabular method, the gradual reaching of the unified formula.</p><p><a href="https://docs.google.com/spreadsheets/d/e/2PACX-1vRfMbHiJynZImn_vAP-5k3LMkry-50ct9CBUDO54c3Zkq4yo4SIhnWnxH5-ZtlLICdQZesYsaqxmVc7/pubhtml">https://docs.google.com/spreadsheets/d/e/2PACX-1vRfMbHiJynZImn_vAP-5k3LMkry-50ct9CBUDO54c3Zkq4yo4SIhnWnxH5-ZtlLICdQZesYsaqxmVc7/pubhtml</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ff9372f3bc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monotonic Stack : an intuitive approach]]></title>
            <link>https://medium.com/@kunalkrishna85/monotonic-stack-an-intuitive-approach-4108af806702?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4108af806702</guid>
            <category><![CDATA[stack]]></category>
            <category><![CDATA[datastrucutre]]></category>
            <category><![CDATA[dsa-problem]]></category>
            <category><![CDATA[monotonic-stack]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Thu, 05 Feb 2026 03:41:59 GMT</pubDate>
            <atom:updated>2026-02-05T03:41:59.093Z</atom:updated>
            <content:encoded><![CDATA[<h3>Monotonic Stack : an intuitive approach</h3><p>Read here : <a href="https://the-dsa.hashnode.dev/monotonic-stack">https://the-dsa.hashnode.dev/monotonic-stack</a></p><p>untill I format this here.</p><p>Hasnode has advantage that it directly renders #markdown text</p><p>In this article I intend to provide greater insight on how to Construct a MS. Many articles exist explaining its applicability. But constructing MS might be confusing. However, after reading this article reader will be able to intuitively design different variations of Monotonic Stack depending on requirements.</p><h4><strong>TL;DR:</strong></h4><p>Before pushing new element ensure insertion doesn’t violate monotonic property.</p><h3>The Structure :</h3><blockquote>1. Define Monotonic Property (requirement analysis)<br>2. Initialize empty stack<br>3. for each `newElt` from input stream<br>4. continue popping stack until pushing `newElt`violates Property<br>5. stack.push(newElt)</blockquote><p>1. Define Monotonic Property (requirement analysis)<br>2. Initialize empty stack<br>3. for each `newElt` from input stream<br>4. ____ continue popping stack <strong><em>until pushing `newElt`violates Property</em></strong><br>5. ____stack.push(newElt)</p><pre>1. Be ready wih Monotonic Property to be enforced<br>2. Initialize empty stack<br>3. for each newElt from input stream<br>4.   continue popping stack until pushing newElt violates Property <br>5.   stack.push(newElt)</pre><p>Only line #1 and #4 needs explanation.</p><h4>1. Defining Monotonic Property</h4><p>While coding step 1 is not explicitly defined . Rather it is enforced via line 4 implementation. But one needs to be clear with what <strong>property</strong> s/he wants to enforce via the stack. This brings us to discussing the types of Monotonic Stack.</p><p>Depending on problem, we can have four different types which we can be ground as two : <br>1. Monotonic **Increasing** Stack<br> 1. **Strictly Increasing** e.g. 1,2,3,4,5 (non-repeating elements)<br> 2. Not Strictly Increasing (or **Non-Decreasing** ) e.g. 1,2,3,3,4,4,5,5 (repeating elements)<br>2. Monotonic **Decreasing** Stack<br> 1. similarly two variations depending on duplicates allowed or not.</p><p>For the sake of generalizability lets stick to the Non-Decreasing Increasing version. <br>#### Monotonic Increasing Stack : Definition<br>Like beauty, definition lies in the eyes of the beholder. Three perspectives, three definitions but same characteristic : <br>- **Popping perspective** : When popping, the popped should be smaller/equal than previously popped element(if exists).<br>- **Pushing perspective** : When pushing, `newElt` should be greater/equal than previously pushed element(if exists).<br>- **External observation (snapshot)** : Although you cannot see all elements of stack but imagine for once you can, then at any time starting from bottom it should grow towards top.</p><p>Formally, add new element to stack only *iff* : <br>* `newElt &gt;= st.top()`<br>In negative terms, the MIS should never add element when `newElt &lt; st.top()` : It is this form of formalization that we shall use in code.</p><p>![[Monotonic Stack 01.png]]<br>![[Mono Stack Correct.png]]<br>*Trick to memorize* : The reference point is always **Base** of the stack <br>Monotonic Increasing Stack = <br>- Monotonic Increasing (from **bottom**) Stack<br>- Monotonic Increasing (from **last pushed element**) Stack</p><p>### 4. newElt violates #1<br>how does this look like for MIS ?</p><p>```python<br>1. # MIS — to be enforeced using line #4<br>2. stack = []<br>3. for each newElt = a[i]<br>4. while newElt &lt; st.top() if st has a top elt<br> st.pop() <br>5. stack.push(newElt)<br>```</p><p>For Monotonic Strictly Increasing Stack we have minor change in #4 : `newElt &lt;= st.top()`</p><p>##### Monotonic Increasing Stack Simulation<br>**Example Array:** `[4, 2, 8, 5, 3]` <br>1. **Input 4:** Stack empty -&gt; Push 4. Stack: `[4]`<br>2. **Input 2:** 2&lt; 4 (top). Pop 4. 2&lt; empty. Push 2. Stack: `[2]`<br>3. **Input 8:** 8&gt;2(top). Push 8. Stack: `[2, 8]`<br>4. **Input 5**: 5&lt;8 (top). Pop 8. 5&gt;2. Push 5. Stack: `[2, 5]`<br>5. **Input 3**: 3&lt;5 (top). Pop 5. 3&gt;2 . Push 3. Stack: `[2, 3]`</p><p>_Final Monotonic Increasing Stack:_ `[2, 3]` (elements are in increasing order)<br>Used to find the next smaller element (nearest element to the right that is smaller)</p><p>![[Mono Stack Simul 0.png]]</p><p>![[Mono Stack Simul.png]]<br>##### Monotonic Decreasing Stack Simulation</p><p>**Example Array:** `[4, 2, 8, 5, 3]` <br>1. **Input 4:** Stack empty -&gt; Push 4. Stack: `[4]`<br>2. **Input 2:** 2&lt;4 (top). Push 2. Stack: `[4, 2]`<br>3. **Input 8:** 8&gt;2 (top). Pop 2. 8&gt;4. Pop 4. Push 8. Stack: `[8]`<br>4. **Input 5:** 5&lt;8 (top). Push 5. Stack: `[8, 5]`<br>5. **Input 3**: 3&lt;5 (top). Push 3. Stack: `[8, 5, 3]`</p><p>_Final Monotonic Decreasing Stack:_ `[8, 5, 3]` (elements are in decreasing order).<br>Used to find the next greater element (nearest element to the right that is larger)</p><p>![[Mono Stack Simul 2.png]]</p><p>[Monotonic Stack/Queue Intro](<a href="https://algo.monster/problems/mono_stack_intro">https://algo.monster/problems/mono_stack_intro</a>) <br>[Introduction to Monotonic Stack](<a href="https://www.designgurus.io/course-play/grokking-the-coding-interview/doc/introduction-to-monotonic-stack">https://www.designgurus.io/course-play/grokking-the-coding-interview/doc/introduction-to-monotonic-stack</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4108af806702" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Mastering Power Set Generation: A Deep Dive into Recursion” from a Java ☕ programmer’s perspective]]></title>
            <link>https://medium.com/@kunalkrishna85/mastering-power-set-generation-a-deep-dive-into-recursion-from-a-java-programmers-perspective-8af9a6d9926f?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af9a6d9926f</guid>
            <category><![CDATA[subset-selection]]></category>
            <category><![CDATA[subsets]]></category>
            <category><![CDATA[recursion]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 08:03:00 GMT</pubDate>
            <atom:updated>2026-01-23T08:03:00.820Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://bloom-jackfruit-f8f.notion.site/Mastering-Power-Set-Generation-A-Deep-Dive-into-Recursion-from-a-Java-programmer-s-perspective-18dd32fa6ba88004ab0fea0d1d989fed">&quot;Mastering Power Set Generation: A Deep Dive into Recursion&quot; from a Java ☕ programmer&#39;s perspective | Notion</a></p><p>To do : eventually import here with proper formatting!</p><p>Till then enjoy reading at notion.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af9a6d9926f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ordering/Sorting in Java : Comparator vs Comparable]]></title>
            <link>https://medium.com/@kunalkrishna85/ordering-sorting-in-java-comparator-vs-comparable-16864e13d63d?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/16864e13d63d</guid>
            <category><![CDATA[collection-framework]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 16:40:09 GMT</pubDate>
            <atom:updated>2026-01-02T16:40:09.921Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ordering/Sorting in Java : Comparator vs Comparable</h3><p>My first article posted on hasnode. I tried hashnode as creating table on medium is nightmare.</p><p><a href="https://compator-vs-comparable.hashnode.dev/comparison-in-java-comparator-vs-comparable?t=1767371444861">https://compator-vs-comparable.hashnode.dev/comparison-in-java-comparator-vs-comparable?t=1767371444861</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16864e13d63d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Euclidean gcd : demystified]]></title>
            <link>https://medium.com/@kunalkrishna85/euclidean-gcd-demystified-0152732fbc2d?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0152732fbc2d</guid>
            <category><![CDATA[lcm-and-hcf]]></category>
            <category><![CDATA[hcf]]></category>
            <category><![CDATA[euclid]]></category>
            <category><![CDATA[gcd]]></category>
            <category><![CDATA[euclidean-algorithm]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Wed, 31 Dec 2025 11:35:24 GMT</pubDate>
            <atom:updated>2026-01-23T08:24:11.071Z</atom:updated>
            <content:encoded><![CDATA[<h3>Euclidean gcd : demystified</h3><p>TL;DR</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*GPAGt0UjWSxd1DWrPPY4HA.png" /></figure><p>G.C.D = greatest common <strong>divisor</strong></p><p>aka</p><p>H.C.F = highest common <strong>factor</strong></p><p>There are <em>many approaches</em> to find gcd of two numbers but in this blog we explore Euclidean algorithm aka. <a href="https://medium.com/india-in-depth/ku%E1%B9%AD%E1%B9%ADaka-n%C4%ABti-5-core-principles-of-an-ancient-indian-algorithm-through-a-strategic-lens-55b62deb148c"><strong>Kuṭṭaka algorithm</strong></a><strong>. </strong>(also read <a href="https://chandrahasblogs.wordpress.com/2024/07/05/linear-indeterminate-equations-part-i-euclids-extended-gcd-algorithm/">this</a>)</p><ul><li>Brute Force : start from smaller number all the way down to 1.</li><li>The Subtraction Method (Original Euclidean)</li><li>The Remainder Method (Optimized Euclidean) ← focused in this article</li></ul><p>My aim here is to make it visually memorizable so that it stays with reader for longer duration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*VGW8QE24kxhFvmZf.jpg" /><figcaption>Basic terms in a division operation</figcaption></figure><p>The Euclidean algorithm logic is:</p><p>GCD(Dividend, Divisor) → GCD(Divisor, Remainder)</p><p>Remember two rules two write gcd function on the fly :</p><blockquote>Current Divisor becomes → next Dividend</blockquote><blockquote>Check Divisor = 0 → return other parameter i.e. Dividend</blockquote><pre><br>start with:<br>  divisor  = min(a,b) = b<br>  dividend = max(a,b) = a<br><br>repeat until remainder != 0 : <br>  divisor(i)   → dividend(i+1) //Current Divisor becomes next Dividend<br>  remainder(i) →  divisor(i+1) //Current Remainder becomes next Divisor<br><br>return last_divisor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*ioikpeAlqFu7JTuDjSnnIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*RivhcupJWUAk_IJBGP6fGQ.png" /></figure><p>What essentially is happening can be summarized as cycle diagram as follows :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*vJCvbqjtrXagIKP4O5H4qg.png" /></figure><p>Alternative <strong>numerator-denominator representation</strong> using %(modulo or remainder operator) :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*nW23YzxTyE_OOBfej1_TqQ.png" /></figure><pre>gcd(a, b) : assume b &lt; a<br>---------------------------------<br> a =  b.q1 + r1 <br> b = r1.q2 + r2<br>r1 = r2.q3 + r3<br>r2 = r3.q4 + r4<br>..<br>...<br>....<br>r(n-3) = r(n-2).q(n-1) + r(n-1)<br>r(n-2) = r(n-1).q(n)   + r(n) = 0 // STOP</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*wV1wwswy0WBXoVRYMjEl9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*xbF90pK5nc6chjqrdX6fLw.png" /><figcaption>Recursive code for gcd : GCD(Dividend, Divisor) → GCD(Divisor, Remainder)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*4m-DmL2BBeTastD9C7Sh2Q.png" /></figure><p>Although it might seem this function assumes the smaller number to be passed as 2nd parameter, this method is acually size agnostic. Why? because GCD(a, b) = GCD(b, a % b) : <em>the remainder replaces the larger number in one step</em>. Let’s verify this through an example.</p><p><strong>Example 1: Proper Order (Big, Small) </strong>— gcd(10, 2)</p><ol><li>b (2) is not 0.</li><li>Call gcd(2, 10 % 2) → gcd(2, 0)</li><li>b is 0. Return 2. <strong>(Done)</strong></li></ol><p><strong>Example 2: Swapped Order (Small, Big)</strong> — gcd(2, 10)</p><ol><li>b (10) is not 0.</li><li>Call gcd(10, 2 % 10) <br>- Note: 2 % 10 is just 2.<br>- So the call becomes gcd(10, 2).</li><li><strong>Look what happened:</strong> It just swapped the arguments! Now it proceeds exactly like Example 1.</li></ol><p><strong>Conclusion:</strong> The order does not matter. The “Small, Big” case just costs <strong>one extra recursion step</strong>.</p><pre>// Divisor becomes Dividend<br>int gcd(int dividend, int divisor) {<br>   if (divisor == 0) <br>      return dividend;<br>   return gcd(divisor, dividend % divisor);<br>}<br>// Remainder becomes Divisor<br>int gcd(int divisor, int remainder) {<br>   if (remainder == 0)<br>      return divisor;<br>   return gcd(remainder, divisor % remainder);<br>}<br><br>// Scenario A<br>int gcd(int a, int b) {<br>   if (b == 0)<br>      return a;<br>   return gcd(b, a % b);<br>}<br>//Scenario B:<br>int gcd(int a, int b) {<br>   if (a == 0)<br>      return b;<br>   return gcd(b % a, a);<br>}<br>// NOTE: if one parameter is checked for zero then return other parameter.<br></pre><h4>Scenario A: The Standard (Checking 2nd Param)</h4><ul><li><strong>Check:</strong> if (b == 0) → You are checking <strong>Slot 2</strong>.</li><li><strong>Recurse:</strong> gcd(b, a % b) → You pass remainder into <strong>Slot 2</strong>.</li><li><strong>Return:</strong> return a → You return <strong>Slot 1</strong> (the survivor).</li></ul><h4>Scenario B: The Swapped (Checking 1st Param)</h4><ul><li><strong>Check:</strong> if (a == 0) → You are checking <strong>Slot 1</strong>.</li><li><strong>Recurse:</strong> gcd(b % a, a) → You pass remainder into <strong>Slot 1</strong>.</li><li><strong>Return:</strong> return b → You return <strong>Slot 2</strong> (the survivor)</li></ul><pre>int gcd(int dividend, int divisor_cum_remainder) {<br>   if (divisor_cum_remainder == 0)<br>      return dividend;<br>   return gcd(divisor_cum_remainder, dividend % divisor_cum_remainder);<br>}</pre><pre>int gcd(int dividend, int divisor) {<br>   if (divisor == 0)<br>      return dividend;<br>   <br>   int dividend = divisor; //Current Divisor becomes next Dividend<br>   int remainder = dividend % divisor;<br><br>   return gcd(dividend, remainder); //Current Remainder becomes next Divisor<br>}</pre><p>MEMORIZE :</p><blockquote><strong>0-check</strong> and <strong>remainder pass </strong>happen in <strong>same slot</strong>.</blockquote><pre>// The only one you need to remember<br>int gcd(int a, int b) { <br>    if (b == 0) return a;     // Check Slot 2<br>    return gcd(b, a % b);     // Remainder to Slot 2<br>}</pre><p>So the algorithm can be :</p><pre>int gcd(int a, int b) {<br>  int divisor = Math.min(a,b); // b<br>  int dividend = (a+b) - divisor;  //a<br>  int remainder = dividend % divisor;<br>  <br>  while (remainder != 0) {<br>    dividend  = divisor;  //Current Divisor becomes next Dividend<br>    divisor   = remainder;//Current Remainder becomes next Divisor<br>    remainder = dividend % divisor;<br>  }<br>  <br>  return divisor;<br>}</pre><p>Or,</p><pre>int gcd(int a, int b) {<br>  int denominator = Math.min(a,b); // b<br>  int numerator   = (a+b) - denominator;  //a<br>  int remainder   = numerator % denominator;<br>  <br>  while (remainder != 0) {<br>    numerator   = denominator; // divisor(i)   → dividend(i+1)<br>    denominator = remainder;   // remainder(i) → divisor(i+1)<br>    remainder   = numerator % denominator;<br>  }<br> <br>  return denominator;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*UhT39MEqP7GWXrd6DiTyzQ.png" /><figcaption>Range of LCM &amp; HCF of two positive numbers</figcaption></figure><ul><li><a href="https://en.wikipedia.org/wiki/Euclidean_algorithm">Euclidean algorithm - Wikipedia</a></li><li><a href="https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/the-euclidean-algorithm">Khan Academy</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0152732fbc2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leetcode 5 — Longetst Palindromic Substring]]></title>
            <link>https://medium.com/@kunalkrishna85/leetcode-5-longetst-palindromic-substring-2d1c3408a162?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d1c3408a162</guid>
            <category><![CDATA[two-pointers]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Tue, 16 Dec 2025 15:40:57 GMT</pubDate>
            <atom:updated>2025-12-17T06:24:36.814Z</atom:updated>
            <content:encoded><![CDATA[<h3>Leetcode 5 — Longetst Palindromic Substring</h3><p><a href="https://leetcode.com/problems/longest-palindromic-substring/description/">https://leetcode.com/problems/longest-palindromic-substring/description/</a></p><p>Official Solution Provides —<a href="https://leetcode.com/problems/longest-palindromic-substring/editorial/"> 3 variations</a> ( Machester algo is out of scope)</p><p>codestorywithMIK has provided — <a href="https://youtu.be/n_kL8BkURVA">2 solution</a> (recursive &amp; memoization)</p><p>However, I wanted to discuss another version of bottom-up dynamic programming approach which is not discussed.</p><pre>class Solution {<br>    public String longestPalindrome(String s) {<br>        int n = s.length();<br>        boolean[][] dp = new boolean[n][n]; <br>        // false : palindrome exist, this reduces need to initialize<br>        int l = 0, r = 0;<br><br>        for(int len = 1; len &lt; n; len++) {<br>            for (int i = 0; i &lt; n-len; i++) {<br>                int j = i + len; <br>                if (s.charAt(i) == s.charAt(j) &amp;&amp; !dp[i+1][j-1]) {<br>                    // s.substring(i+1,j-1) IS palindrome &amp; can increase by +2<br>                    l = i;<br>                    r = j;<br>                } else { <br>                    // s.substring(i,j) is NOT palindrome<br>                    dp[i][j] = true;<br>                }<br>            }<br>        }<br>        return s.substring(l, r+1);<br>    }<br>}</pre><p>This builds up the dp table as follows :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/157/1*PB66l-gDw1Bb3rcwyaIwDA.png" /></figure><p>Time Complexity = O(n²); Space Complexity = O(n²)</p><p>Since at any time only previous row is being accessed we can reduce it to O(n) space.</p><pre>class Solution {<br>    public String longestPalindrome(String s) {<br>        int n = s.length();<br>        boolean[][] dp = new boolean[2][n]; // false : palindrome exist, this reduces need to initialize<br>        int l = 0, r = 0;<br><br>        for(int i = n-2; i &gt;= 0; i--) {<br>            for (int j = i+1; j &lt; n; j++) {<br>                if (s.charAt(i) == s.charAt(j) &amp;&amp; !dp[0][j-1] ) {<br>                    if(j-i &gt; r-l) {<br>                        l = i;<br>                        r = j;<br>                    }<br>                } else {<br>                    dp[1][j] = true;<br>                }<br>            }<br>            dp[0] = Arrays.copyOf(dp[1], n); <br>            Arrays.fill(dp[1], false); //reset<br>        }<br>        return s.substring(l, r+1);<br>    }<br>}<br></pre><p>If dp[i][j] = true represented presence of palindromic substring betwen i &amp; j then the table progress would look like this for string s = “abbcccba”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*chb6Kxk8T0t1Rz7Czr36BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*8Ii7UX8znK_V7lfLC1D5eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*7V6ywwQQm5u-Jk5w_lYUpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*xvPs067ez8cjBJE0Ringgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*w-kGGmr0CGIOaa_OP0j4Nw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/233/1*WCDnUgmpxflpZFbbh4R8cQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*e_TlGhPex_1zyi9VvWTjsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/1*V0tUTnU3xdNhvGzz5SOuzw.png" /></figure><p>&gt; Read comprehensive solution compiled by me to gain more insight at : <a href="https://leetcode.com/problems/longest-palindromic-substring/solutions/7419068/all-solution-compiled-by-thevagabond85-wmd2/">https://leetcode.com/problems/longest-palindromic-substring/solutions/7419068/all-solution-compiled-by-thevagabond85-wmd2/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d1c3408a162" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[]Multiple Java Installation]]></title>
            <link>https://medium.com/@kunalkrishna85/multiple-java-installation-5d630ab28a18?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d630ab28a18</guid>
            <category><![CDATA[jdk]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[jdk21]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Tue, 02 Dec 2025 09:05:23 GMT</pubDate>
            <atom:updated>2026-01-25T09:30:38.392Z</atom:updated>
            <content:encoded><![CDATA[<h3>Multiple JDK Installation : Best Practise</h3><p>Often as a developer one might have to install multiple versions of Java(JDK) and interchange between them depending on use case(Professional developement, trying latest JDK, experimenting with differnt vedors — oracle, Amazon Corretto, Red Hat).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*pAeaQSTT3j9mGZQvkBWf7w.png" /><figcaption>img 1 : A windows system showing two latest version (21,25) installed</figcaption></figure><p>You can install many java versions on a single system and depending on requirement you can select required version by simply changing Environment variables. In other words, env var is the controller</p><p>In this post, I intend to complile my understanding of several things one needs to keep in mind.</p><ul><li>Terminal</li><li>Environment Variables - configuration &amp; verification</li><li>JDK installation</li><li>IntelliJ idea</li></ul><h3>Terminal</h3><p>The main commands for this context are</p><ul><li>java --version : shows current java version recognized by system<br> — javac --version : shows current compiler recognized by system</li><li>where java : location of installation of current java</li></ul><h3>Environment Variable</h3><ul><li>Windows reads Environment Variable Path list from <strong>Top to Bottom</strong>.</li><li><strong>Stop fast</strong> : as soon as it finds the first match it stops finding another path.</li><li>System32 is almost always at the top of env variables meaning any installation in this path gets high priority.</li><li>After any fresh installation or adding new path variables, close System Properties tab to see effect of newly added paths.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*P4sHnOjJhx1lLIZEerniYg.png" /><figcaption>img 2 :Reopen to see updated environment variables after every install</figcaption></figure><ul><li>Althouth not tested but I would recommend in a similar way after deleting any env variable press ok and close this tab.</li></ul><h3>JDK Installation</h3><ul><li>Prefer installing LTS versions (21, 25)</li><li>Installation does three important things : <br> — creates files in : C:\Program Files\Java\jdk-XX<em> </em>(XX= version e.g 21, 25) (img 3)<br> — creates shortcuts of executables in : C:\Program Files\Common Files\Oracle\Java\javapath (img 4).<br> — also adds this path on top in Environment VariablesSystem Path (img 6).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*rD0eyRwirPFn_cw8hCNfLQ.png" /><figcaption>img 3</figcaption></figure><p>Before Java 8 :</p><p>Oracle JDK installer would put a copy of java.exe into a high priority folder C:\Windows\System32 . This made it messay and hard to manage multiple versions.</p><p>After Java 8+ (SymLink Era) :</p><p>Oracle stopped putting in System32. Instead they created a hidden folder : C:\Program Files\Common Files\Oracle\Java\javapath</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*abs-V1gn9iKSubnCBMjZWg.png" /><figcaption>img 4 : SymLink</figcaption></figure><p>This folder contains “Symlink” (shortcut) pointing the latest JDK installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*l59FsbcSfASBLhIC3mF9hQ.png" /><figcaption>img 5 : shortcuts(SymLink)</figcaption></figure><p><strong><em>Note </em></strong>: Oracle installed forces this javapath folder to the very top of System Path</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*3rGH6aZPpSlNh9JYthlOJw.png" /><figcaption>img 6 :Oracle forces javapth to the top of System Path</figcaption></figure><p><strong><em>Note : </em></strong>the last JDK you installed (JDK 25) overwrites the symlinks in that folder and takes over your terminal, regardless of what JAVA_HOME you set.</p><p>So whenever you install a new JDK you will loose acess to older JDK installations. How to use older versions?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*7TigoZFuUF4MXOgHWw7Djw.png" /><figcaption>img 7 : Terminal showing two installations</figcaption></figure><p>&gt; To access a specific JDK , create env_variable for that older java version which you want to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*aEFTBy82YCrwH_WxGYDt_w.png" /><figcaption>img 8 :</figcaption></figure><p>&gt; Add this System Variable JAVA_HOME_21 inSystem Path : and place it below java 25 path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*ZL8ypOpDh6ZLkX-6pzV7Fg.png" /><figcaption>img 9 : the java version which you want to use should be at higher level than other java version path</figcaption></figure><p>To test java version close env variable setting winown and open a <em>new</em> terminal and type java -- version</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*e6O_ifCoKC9Cyijxotc9UA.png" /><figcaption>img 10 : java -- version to see check current version</figcaption></figure><p>You can have many more jdk installed and select to any . The only rule you need to remember is :</p><blockquote>The java version which you want to use should be at <strong>higher level</strong> than other java version path in System Path .</blockquote><p>Now let us see how to install <a href="https://jdk.java.net/25/">3rd java</a> : openjdk-25.0.1</p><p>&gt; Extract compressed file → this creates directory output openjdk-25.0.1_windows-x64_bin .</p><p>&gt; Inside this lies jdk-25.0.1 . Copy this to your Java dir</p><p>&gt; This directory contains the bin and therefore the path of this director needs to be added to system path inorder to make it usable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*bft1oM3WBZ3inMzdzFIhsg.png" /><figcaption>img 11 : installing openJDK-25</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*x5jAZxc1e-p5APioYU8GLA.png" /><figcaption>img 12 : adding sys path for openJDK-25</figcaption></figure><p>Now apply the rule in sys path — move this new variable to top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t6HXHqwD2sHkXmPjiqqt1A.png" /></figure><p>Test current version on, remember <em>new</em>, cmd : user java --versionor javac --version</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*AKgsShl1uwHpZ3pX7yO8VA.png" /></figure><p><strong><em>Note</em></strong> : when the first value in Path starts with %(except %SystemRoot%) the window open differently (No move up, move down button). To fix this see <a href="https://stackoverflow.com/questions/69290834/when-i-try-to-open-path-from-system-environment-variables-on-windows-10-it-doesn#comment140883087_69319858">this</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*tzb-S8Lgz9L39AhAOhawJg.png" /></figure><p><strong><em>Fix</em></strong> : It is because it has % in it and it is not followed by SystemRoot. Windows recognizes variable Path having tompmost value starting with %AnyString as ordinary variable. Howerver, notable exception to this is $SystemRoot% which equals C:\WINDOWS . If you keep this on top, it still opens a detailed window. (This user reporeted from Win 11 experience)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*6ATHZninpDIbQhS6Qy4v5w.png" /><figcaption>Full scree restored</figcaption></figure><h3>IntelliJ Idea</h3><p>InetelliJ allows to chose java version at project level. I will update more on this later.</p><p>Ctrl + Alt + Shit + S opens Project Structure settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*RABcp_v6RnM2q6mD32mhDA.png" /></figure><p>Pressing green + button allows to add any installed java. These added SDKs are ready to be attached to any project. This makes any project modular. Any project can be coupled with any java enviornement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*aFeZ0VWXmrSasTJ_0Bklew.png" /></figure><p>Now to chose Java for a project. Open the project in InjelliJ IDE and see on top right. There chose Edit Config`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*1ZSRmtsXrzcRqwzVhA0SiA.png" /></figure><p>Now chose suitable Java version :</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d630ab28a18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Dra]Map in Java Collection Framework]]></title>
            <link>https://medium.com/@kunalkrishna85/dra-map-in-java-collection-framework-fa3bbe0020de?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa3bbe0020de</guid>
            <category><![CDATA[collection]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[hashmap-in-java]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Sun, 30 Nov 2025 08:43:44 GMT</pubDate>
            <atom:updated>2025-11-30T09:19:59.792Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Draft] Map in Java Collection Framework</h3><p>A fresh perspective to study Map interface with focus on maximum recall value.</p><p>Most representation of Map collections on web are misleading (not true representation) or limited(HM, LHM,TM) so I created a fresh, more accurate diagram using draw.io.</p><figure><img alt="diagram representing class hierarchy of java.util.map package" src="https://cdn-images-1.medium.com/max/693/1*jALJg2dW0m2ZtTY5TYhYiA.png" /><figcaption>Diagram representing class hierarchy of java.util.map package</figcaption></figure><p><strong>All Known Subinterfaces</strong>:</p><ul><li><a href="https://docs.oracle.com/javase/8/docs/api/java/util/SortedMap.html">SortedMap</a>&lt;K,V&gt; extends Map&lt;K,V&gt;<br> — <a href="https://docs.oracle.com/javase/8/docs/api/java/util/NavigableMap.html">NavigableMap</a>&lt;K,V&gt; extends SortedMap&lt;K,V&gt;<br> — <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentNavigableMap.html">ConcurrentNavigableMap</a>&lt;K,V&gt; extends ConcurrentMap&lt;K,V&gt;, NavigableMap&lt;K,V&gt;</li><li><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentMap.html">ConcurrentMap</a>&lt;K,V&gt; extends Map&lt;K,V&gt;</li></ul><p><strong>All Known Implementing Classes</strong>:</p><p>Abstract class</p><ul><li><a href="https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html">AbstractMap</a> implements Map&lt;K,V&gt;</li></ul><p>Class</p><ul><li><a href="https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html">HashMap</a>, extends AbstractMap&lt;K,V&gt;<br>- <a href="https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html">LinkedHashMap</a> extends HashMap&lt;K,V&gt;</li><li><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html">ConcurrentHashMap</a> extends AbstractMap&lt;K,V&gt; implements ConcurrentMap&lt;K,V&gt;, Serializable</li><li><a href="https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html">TreeMap</a> extends AbstractMap&lt;K,V&gt; implements NavigableMap &lt;K,V&gt;, Cloneable, Serializable</li><li>WeakHashMap extends AbstractMap&lt;K,V&gt;</li></ul><p>Now let’s look at the APIs/methods of Map interface categoriezed by functionality :</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatawrapper.dwcdn.net%2FxzkBe%2F3%2F&amp;display_name=Datawrapper&amp;url=https%3A%2F%2Fdatawrapper.dwcdn.net%2FxzkBe%2F3%2F&amp;image=https%3A%2F%2Fdatawrapper.dwcdn.net%2FxzkBe%2Fplain-s.png%3Fv%3D3&amp;type=text%2Fhtml&amp;schema=dwcdn" width="600" height="1029" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e941b8e2e461b0d84d7f19ab9a58645/href">https://medium.com/media/7e941b8e2e461b0d84d7f19ab9a58645/href</a></iframe><pre><br>Map&lt;String, Integer&gt; counts = new HashMap&lt;&gt;();<br><br>for (String word : words) {<br>    // Logic: <br>    // 1. If &quot;word&quot; is missing, put 1.<br>    // 2. If &quot;word&quot; exists, take old count (a) and add 1 (b).<br>    counts.merge(word, 1, (oldVal, newVal) -&gt; oldVal + newVal);<br>    <br>    // Or simpler with Method Reference:<br>    // counts.merge(word, 1, Integer::sum);<br>}</pre><p>CREATING Bulletpoints in medium in nightmare</p><ul><li>sdfsaf</li></ul><ol><li>sdfs</li><li>sfd -</li></ol><ul><li>asdfsdf<br>- sdafsf<br>- asdfsdf<br>-</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa3bbe0020de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anti-Defection : A classic case of Politics without Principle in India]]></title>
            <link>https://medium.com/@kunalkrishna85/anti-defection-a-classic-case-of-politics-without-principle-in-india-a7d16a835818?source=rss-89d464e7f1b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7d16a835818</guid>
            <category><![CDATA[law]]></category>
            <category><![CDATA[anti-defection]]></category>
            <category><![CDATA[political-parties]]></category>
            <category><![CDATA[india]]></category>
            <dc:creator><![CDATA[kunalkrishna85]]></dc:creator>
            <pubDate>Sat, 02 Jul 2022 18:56:05 GMT</pubDate>
            <atom:updated>2025-12-16T15:42:42.189Z</atom:updated>
            <content:encoded><![CDATA[<h3>Anti-Defection : A classic case of Politics without Principle in India</h3><p>After reading this, you shall be able to understand the following :</p><ul><li>What is <em>political</em> defection? (as per 10th shedule)</li><li>Anti-defection law : features?</li><li>Advantage &amp; Disadvantages of this law</li><li>Relevant Amendment, Schedules of the Constitution of India</li><li>Scope of Applicability: Anti-defection law in Rajy Sabha?</li><li>Judgments — Kihoto Hollohon vs. Zachilhu and Others, 1992 etc.</li><li>Evaluation of law : Impact of AD law? Good &amp; Bad ? Why need to reform? Is it even relevant today?</li><li>And finally, What are suggested reforms?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*iVP4SbKjJqMwh870.jpg" /><figcaption>The Tenth Schedule was added by 52nd Constituional Amendment Act.</figcaption></figure><h4>A constitutional correctives against a political evil</h4><p>First, let us briefly familirize with Anti-Defection law of the country.</p><ul><li>introduced by 52nd Amendment Act,1985 (PM Rajiv Gandhi)</li><li>added <a href="https://www.mea.gov.in/Images/pdf1/S10.pdf">10th Schedule</a> : Articles <a href="https://www.constitutionofindia.net/constitution_of_india/the_union/articles/Article%20102">102(2)</a> &amp;<a href="https://www.constitutionofindia.net/constitution_of_india/the_states/articles/Article%20191">191(2)</a> - Disqualifications for membership</li><li>A legislator is deemed to have <strong>defected </strong>if he either <em>voluntarily gives up membership of his party</em> or <em>disobeys the directives of the party leadership</em> on a vote.</li></ul><blockquote>described by the SC as “constitutional correctives against a legislatively perceived <strong>political evil</strong> of unprincipled defections induced by the lure of office and monitory inducements”</blockquote><ul><li>Anti-Defection law essentially tries to solve a POLITICAL PROBLEM using LEGAL TOOL.</li></ul><h4>Demand of Contemporary Politics</h4><p>Significance(need) of Anti-Defection Law</p><ul><li>provide <strong>stable government</strong> ⇒ strengthens democracy</li><li>guaranteeing that the govt’s legislative programs are not harmed by a defecting member.</li><li>reduces <strong>political corruption</strong></li><li>insulate legislators from defections (an inhibitor to party-hopping legislators) / to prevent horse trading</li><li>makes <strong>legislators more accountable &amp; faithful to the parties</strong> with which they were aligned at the time of their election</li></ul><p>Ok, now that we understand the imperative for introducing the law, its time to dive into the main provisions of the anti-defection law.</p><h4>Provisions of the Anti-Defection Law</h4><p>And the first question comes up about, what constiute defection i.e, in other wrods, what actions of legislators invite penalty(disqualification) under the 10th schedule.</p><p><strong>Conditions of Disqualification</strong> : basically there are 4 grounds depending on legislators pre-poll relation with the political party.</p><p>For legislator elected on a Political Party ticket :</p><ol><li><strong><em>voluntarily</em></strong><em> giving up membership</em> of a political party (not membership of the House)</li><li>Votes or Does not vote opposed to party’s whip.</li></ol><p>{1&amp;2 are not applicable if : prior permission taken, or condoned by the party within 15 days}</p><p>For non-party affiliated legislators :</p><p>3. <strong>Independent Candidate</strong>: joins any party post-election {PS : In 2006, Madhu Koda became only third <a href="https://www.oneindia.com/2006/09/15/koda-will-be-only-third-independent-to-become-chief-minister-1158314772.html">Independent to become CM</a>}</p><p>4. <strong>Nominated member</strong> joins a party 6 months after becoming a legislature member (she has to decide within a stipulated time)</p><p>These provisions, especially, condition#1 requires in-depth understanding to critically appraise the law.</p><p>Analysis :</p><ul><li>“voluntarily giving up membership of a political party” interpreted in broad sense</li><li><strong><em>Ravi S. Naik vs UoI(1994)</em></strong>: inference can be drawn from the CONDUCT of a member</li><li><strong><em>G. Vishwanathan</em></strong> v. Speaker, TN Leg Assembly(1996): even if the expelled member joins another political party ⇒ voluntarily given up membership</li><li><strong><em>Sri Rajendra Singh Rana</em></strong> vs Swami Prasad Maurya (2007)): <strong>formal resignation not required</strong>, an inference can be drawn from legislator’s conduct → S<a href="https://www.thehindu.com/news/national/sharad-yadav-disqualified-from-rs/article21262499.ece">harad Yadav disqualified from RS</a></li><li>it made legislators liable to be penalised for their conduct both inside (voting against the whip of the party) and outside (making speeches, etc.) the legislature.</li><li><strong>resignation from party membership</strong> vs <strong>resignation as legislator</strong> is two different thing; first invites disqualification under Anti-defection law, later ceases house membership(an otherwise routine act).</li></ul><p>Another question pertaining to the law is that what is the scope or ambit of the law i.e. does it apply in the Upper House or does it apply in election of the President ?</p><p><strong>Scope of the Law</strong> : <em>very broad</em></p><ul><li>all votes in the House, on every Bill and every other issues (non-just limited to confidence motions or quasi-confidence motions like Money Bills)</li><li>even to (procedures inside) Rajya Sabha &amp; Legislative Councils (RS has no say in the govt stability)</li><li>even Presiding Officer can become subject to such disqalification</li></ul><p>However, it is Not Applicable in : any vote deemed “Outside the House”</p><ol><li>Vice Presidential poll</li><li><a href="https://www.deccanherald.com/content/621283/anti-defection-law-does-not.html">Presidential Election</a>(secret ballot): EC clarified in 2017</li><li><a href="https://www.deccanherald.com/content/626485/anti-defection-law-no-help.html">Rajya Sabha Election</a>(open ballot): election of RS member conducted in State Legislative Assembly</li></ol><p>Notably issuing whip in case#2 constitute an offence under IPC’s section 171C. However, in case#3 party can issue whip and a defiant MLA is not disqualified from membership of the house though she can be expelled from the party.</p><p>The underlying reason for excepting the ‘outside house’ votes from the ambit of Anti-defection law can be understood from Kuldip Nair case of 2006 where SC held that <strong>open ballot votes in Rajya Sabha elections</strong> against the whip will <strong>not lead to disqualification</strong>, as the Tenth schedule pertaining to Anti defection provisions, has a <strong>different purpose</strong>(Stability in Government).</p><h4>Principled Defection permitted</h4><p><strong>Exceptions</strong> : member not disqualified if</p><ul><li>at least 2/3 of member of party in House its party legislators voted for the MERGER (merge with another party — <a href="https://www.thehindu.com/opinion/lead/do-not-weaken-the-anti-defection-law/article65586663.ece">cannot operate as separate group</a>)</li><li>eg Meghalaya 2021, 12 of 17 Congress MLAs joined AITC. Rajasthan 2019, all six BSP MLAs joined the Congress. RS 2019, 4 of 6 Telgu Desam RS-MPs joined the BJP.</li><li>elected Speaker/Chairman relinquishes party membership</li><li>the Speaker/Chiariman after ceasing to hold such office rejoins the political party to which he belonged immediately before being elected.</li></ul><p>Analysis: The law punishes only perceived unprincipled defections. It allows <strong>principled defection</strong>.</p><h4>Adjucating Authority : Absolute power currupts</h4><p><strong>Deciding Authority</strong> wrt Disqualification on ground of Defection :</p><ul><li>Speaker / Chairman</li><li>When Sp/Ch has become subect of such Disqualification : Member of House elected by the House acts as Deciding Authority (Note: even Presiding officier can be disqualified)</li><li><strong><em>Kihoto Hollohan vs Zachillhu &amp; Others(1992</em></strong>) — held that the Presiding officer act as Tribunal. It reaffirmed Judicial Review</li></ul><p>Now let us analyse the implication for legislator if disqualified under Tenth Schedule :</p><ul><li>the <strong>penalty </strong>for defection is loss of legislative office</li><li>If a member of the current House (say,15th legislative assembly) is disqualified ⇒ s/he cannot contest any election(by-elections) to the current House. However, he can still contest the next assembly election(16th).</li></ul><p>Analysis : the law condones(approves) the legislator if he gets re-elected. <br>Case Study: Karnataka INC+JD(U) — defactor legislators were disqualified &amp; barred from contesting election from remaining 3 years but SC upheld the disqualification but quashed the ban on contesting election for remaining term. ⇒ majority of them re-contested and got re-elected</p><p>[former CEC SY Quereshi argues for disqualifying for min 6 years as cool off period &amp; to demotivate the defectors]</p><p><em>to be continued…</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7d16a835818" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>