<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Algorithms on </title>
    <link>https://www.compilemymind.com/tags/algorithms/</link>
    <description>Recent content in Algorithms on </description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sat, 09 Aug 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.compilemymind.com/tags/algorithms/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Remove Duplicates from a Sorted Array — The Two-Pointer Technique</title>
      <link>https://www.compilemymind.com/posts/remove-duplicates-from-sorted-array/</link>
      <pubDate>Sat, 09 Aug 2025 00:00:00 +0000</pubDate>
      <guid>https://www.compilemymind.com/posts/remove-duplicates-from-sorted-array/</guid>
      <description>&lt;p&gt;Removing duplicates from a sorted array is one of those problems that sounds trivial until you add the constraint: do it &lt;strong&gt;in-place&lt;/strong&gt;, without allocating another array. That constraint is what makes it interesting and what makes the &lt;strong&gt;two-pointer pattern&lt;/strong&gt; the right tool.&lt;/p&gt;&#xA;&lt;p&gt;The problem: given a sorted integer array &lt;code&gt;nums&lt;/code&gt;, remove duplicates in-place so each unique element appears exactly once. Return &lt;code&gt;k&lt;/code&gt; — the count of unique elements. The values at &lt;code&gt;nums[0]&lt;/code&gt; through &lt;code&gt;nums[k-1]&lt;/code&gt; must be the unique elements in order; anything beyond index &lt;code&gt;k-1&lt;/code&gt; doesn&amp;rsquo;t matter.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Solving LeetCode&#39;s Valid Parentheses Problem with a Stack in Java</title>
      <link>https://www.compilemymind.com/posts/how-to-solve-leetcode-valid-parentheses-using-stack-in-java/</link>
      <pubDate>Wed, 06 Aug 2025 00:00:00 +0000</pubDate>
      <guid>https://www.compilemymind.com/posts/how-to-solve-leetcode-valid-parentheses-using-stack-in-java/</guid>
      <description>&lt;p&gt;Some LeetCode problems feel like busy work. The Valid Parentheses problem is not one of them. It&amp;rsquo;s a clean, well-defined problem that teaches a genuinely useful pattern — the &lt;strong&gt;stack&lt;/strong&gt; — and produces code that&amp;rsquo;s actually elegant when you get it right.&lt;/p&gt;&#xA;&lt;p&gt;The problem: given a string containing only &lt;code&gt;(&lt;/code&gt;, &lt;code&gt;)&lt;/code&gt;, &lt;code&gt;{&lt;/code&gt;, &lt;code&gt;}&lt;/code&gt;, &lt;code&gt;[&lt;/code&gt;, and &lt;code&gt;]&lt;/code&gt;, determine if the input is valid. A string is valid if every opening bracket is closed by the correct bracket type, in the correct order.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
