<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Preethii V</title>
    <description>The latest articles on DEV Community by Preethii V (@preethii_v_192006).</description>
    <link>https://dev.to/preethii_v_192006</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3875420%2Ffd37f82d-853a-46e3-87f6-1fd0b73f4798.jpeg</url>
      <title>DEV Community: Preethii V</title>
      <link>https://dev.to/preethii_v_192006</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/preethii_v_192006"/>
    <language>en</language>
    <item>
      <title>🏏 The 18-Day DSA Cover Drive | Day 4: The 5 Questions I Ask Before Solving Any DSA Problem</title>
      <dc:creator>Preethii V</dc:creator>
      <pubDate>Mon, 06 Jul 2026 16:14:47 +0000</pubDate>
      <link>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-4-the-5-questions-i-ask-before-solving-any-dsa-problem-2dl1</link>
      <guid>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-4-the-5-questions-i-ask-before-solving-any-dsa-problem-2dl1</guid>
      <description>&lt;h1&gt;
  
  
  🏏 The 18-Day DSA Cover Drive | Day 4— How I Identify DSA Patterns Before Writing Code
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Learn DSA one pattern at a time.
&lt;/h3&gt;

&lt;p&gt;What's up, DEV Community! 👋&lt;/p&gt;

&lt;p&gt;Welcome back to &lt;strong&gt;The 18-Day DSA Cover Drive&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏆 Kohli Corner
&lt;/h2&gt;

&lt;p&gt;🏏 &lt;strong&gt;"The best batters don't guess the ball. They read it."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Virat Kohli doesn't decide his shot before the bowler releases the ball.&lt;/p&gt;

&lt;p&gt;He watches.&lt;/p&gt;

&lt;p&gt;He reads.&lt;/p&gt;

&lt;p&gt;Then he chooses the perfect shot.&lt;/p&gt;

&lt;p&gt;💡 DSA is no different.&lt;/p&gt;

&lt;p&gt;Don't memorize solutions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read the problem first. Choose the right pattern. Then write the code.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  🧩 Day 4 — Pattern Recognition
&lt;/h1&gt;

&lt;p&gt;When I started learning DSA, every problem looked different.&lt;/p&gt;

&lt;p&gt;Some people said,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Just solve 500 questions."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But I realized something...&lt;/p&gt;

&lt;p&gt;Experienced programmers don't memorize problems.&lt;/p&gt;

&lt;p&gt;They recognize &lt;strong&gt;patterns&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now, before writing a single line of code, I ask myself these &lt;strong&gt;5 simple questions&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  ❓ Question 1
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Is the data continuous?
&lt;/h2&gt;

&lt;p&gt;Look for words like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subarray&lt;/li&gt;
&lt;li&gt;Substring&lt;/li&gt;
&lt;li&gt;Contiguous&lt;/li&gt;
&lt;li&gt;Continuous&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🎯 &lt;strong&gt;Think: Sliding Window&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  ❓ Question 2
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Does the order matter?
&lt;/h2&gt;

&lt;p&gt;If &lt;strong&gt;YES&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;➡️ Keep the original order.&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;NO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;➡️ Sorting might make the problem much easier.&lt;/p&gt;




&lt;h1&gt;
  
  
  ❓ Question 3
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Am I searching for the same thing repeatedly?
&lt;/h2&gt;

&lt;p&gt;Look for words like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frequency&lt;/li&gt;
&lt;li&gt;Count&lt;/li&gt;
&lt;li&gt;Duplicate&lt;/li&gt;
&lt;li&gt;Lookup&lt;/li&gt;
&lt;li&gt;Pair&lt;/li&gt;
&lt;li&gt;Already seen&lt;/li&gt;
&lt;li&gt;Mapping&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🎯 &lt;strong&gt;Think: Dictionary (HashMap)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Do I need to remember information?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If yes...&lt;/p&gt;

&lt;p&gt;Use a &lt;strong&gt;Dictionary&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  ❓ Question 4
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Am I comparing from both ends?
&lt;/h2&gt;

&lt;p&gt;Keywords:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sorted Array&lt;/li&gt;
&lt;li&gt;Palindrome&lt;/li&gt;
&lt;li&gt;Reverse&lt;/li&gt;
&lt;li&gt;Pair&lt;/li&gt;
&lt;li&gt;Left&lt;/li&gt;
&lt;li&gt;Right&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🎯 &lt;strong&gt;Think: Two Pointers&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  ❓ Question 5
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Is my brute-force solution repeating work?
&lt;/h2&gt;

&lt;p&gt;If you're calculating the same thing again...&lt;/p&gt;

&lt;p&gt;There is probably a better approach.&lt;/p&gt;

&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Can I reuse my previous work?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  ⚡ My Pattern Decision Tree
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Problem
   │
   ▼
Subarray / Substring?
   │
 YES ─────────► Sliding Window
   │
   NO
   │
Need Frequency?
   │
 YES ─────────► Dictionary
   │
   NO
   │
Need Unique Elements?
   │
 YES ─────────► Set
   │
   NO
   │
Sorted / Palindrome / Pair?
   │
 YES ─────────► Two Pointers
   │
   NO
   │
Start with Brute Force.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  🏏 Cover Drive Cheat Sheet
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;If the problem says...&lt;/th&gt;
&lt;th&gt;Think...&lt;/th&gt;
&lt;th&gt;Ask Yourself&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Frequency, Count, Lookup&lt;/td&gt;
&lt;td&gt;🗂️ Dictionary&lt;/td&gt;
&lt;td&gt;Do I need to remember information?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Duplicate, Unique, Visited&lt;/td&gt;
&lt;td&gt;📦 Set&lt;/td&gt;
&lt;td&gt;Do I only care if it exists?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sorted Array, Pair, Reverse, Palindrome&lt;/td&gt;
&lt;td&gt;👉👈 Two Pointers&lt;/td&gt;
&lt;td&gt;Can two indices move together?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subarray, Substring, Contiguous&lt;/td&gt;
&lt;td&gt;🪟 Sliding Window&lt;/td&gt;
&lt;td&gt;Can I reuse previous work?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Window Size = K&lt;/td&gt;
&lt;td&gt;📏 Fixed Sliding Window&lt;/td&gt;
&lt;td&gt;Remove one, add one?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Longest / Shortest&lt;/td&gt;
&lt;td&gt;🔄 Variable Sliding Window&lt;/td&gt;
&lt;td&gt;Expand or shrink the window?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  💼 Interview Insight
&lt;/h1&gt;

&lt;p&gt;One habit I'm trying to build:&lt;/p&gt;

&lt;p&gt;❌ Don't jump into coding.&lt;/p&gt;

&lt;p&gt;✅ Spend the first minute asking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What are the keywords?&lt;/li&gt;
&lt;li&gt;Which pattern fits?&lt;/li&gt;
&lt;li&gt;Why does it fit?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choosing the correct pattern is often harder than writing the code.&lt;/p&gt;




&lt;h1&gt;
  
  
  🏏 Nets Practice
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Which pattern would you choose?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🥎 Problem 1
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Find the longest substring without repeating characters.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;🤔 Pattern?&lt;/p&gt;




&lt;h3&gt;
  
  
  🥎 Problem 2
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Find whether an array contains duplicate elements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;🤔 Pattern?&lt;/p&gt;




&lt;h3&gt;
  
  
  🥎 Problem 3
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Find two numbers in a sorted array whose sum equals the target.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;🤔 Pattern?&lt;/p&gt;




&lt;h3&gt;
  
  
  🥎 Problem 4
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Find the maximum sum of a subarray of size &lt;code&gt;k&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;🤔 Pattern?&lt;/p&gt;




&lt;p&gt;👇 &lt;strong&gt;Comment only the pattern names.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No code.&lt;/p&gt;

&lt;p&gt;Let's see how many you get right!&lt;/p&gt;




&lt;h1&gt;
  
  
  🏏 Cover Drive of the Day
&lt;/h1&gt;

&lt;p&gt;🏏 &lt;strong&gt;Concept:&lt;/strong&gt; Pattern Recognition&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;Goal:&lt;/strong&gt; Identify the pattern before writing code.&lt;/p&gt;

&lt;p&gt;💼 &lt;strong&gt;Interview Insight:&lt;/strong&gt; One minute of thinking can save thirty minutes of debugging.&lt;/p&gt;




&lt;h3&gt;
  
  
  💬 Let's Discuss
&lt;/h3&gt;

&lt;p&gt;When you first started DSA...&lt;/p&gt;

&lt;p&gt;Which pattern confused you the most?&lt;/p&gt;

&lt;p&gt;Or...&lt;/p&gt;

&lt;p&gt;Do you have another trick for identifying patterns quickly?&lt;/p&gt;

&lt;p&gt;I'd love to learn from your experience too! 👇&lt;/p&gt;




&lt;p&gt;18DayDSACoverDrive | Python | DSA | Algorithms | Beginners&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>beginners</category>
      <category>computerscience</category>
      <category>learning</category>
    </item>
    <item>
      <title>🏏 The 18-Day DSA Cover Drive | Day 3 — Sliding Window: Stop Recalculating, Start Sliding</title>
      <dc:creator>Preethii V</dc:creator>
      <pubDate>Fri, 03 Jul 2026 17:32:04 +0000</pubDate>
      <link>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-3-sliding-window-stop-recalculating-start-sliding-5d4f</link>
      <guid>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-3-sliding-window-stop-recalculating-start-sliding-5d4f</guid>
      <description>&lt;h1&gt;
  
  
  🏏 The 18-Day DSA Cover Drive | Day 3 — Sliding Window: Stop Recalculating, Start Sliding
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Learn DSA one pattern at a time.
&lt;/h3&gt;

&lt;p&gt;What's up, DEV Community! 👋&lt;/p&gt;

&lt;p&gt;Welcome back to &lt;strong&gt;Day 18&lt;/strong&gt; of &lt;strong&gt;The 18-Day DSA Cover Drive&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏆 Kohli Corner
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Legacy isn't built in one innings.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Virat Kohli's cover drive wasn't perfected overnight.&lt;/p&gt;

&lt;p&gt;Thousands of practice balls.&lt;/p&gt;

&lt;p&gt;Hundreds of innings.&lt;/p&gt;

&lt;p&gt;One unforgettable shot.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The same goes for DSA. Great problem-solving isn't about memorizing solutions. It's about training your thinking until patterns become instinct.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  📊 Day 3 — Sliding Window
&lt;/h1&gt;

&lt;h2&gt;
  
  
  🎯 Today's DSA Power-Up
&lt;/h2&gt;

&lt;p&gt;Imagine you're solving this problem:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Find the maximum sum of any subarray of size &lt;code&gt;k&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your first instinct?&lt;/p&gt;

&lt;p&gt;Probably nested loops.&lt;/p&gt;

&lt;p&gt;Mine too. 😅&lt;/p&gt;




&lt;h2&gt;
  
  
  ❌ The Brute Force Mindset
&lt;/h2&gt;

&lt;p&gt;For every starting position...&lt;/p&gt;

&lt;p&gt;Calculate the sum again.&lt;/p&gt;

&lt;p&gt;And again.&lt;/p&gt;

&lt;p&gt;And again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;max_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;current_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;current_sum&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;max_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_sum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;current_sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Works?&lt;/p&gt;

&lt;p&gt;✅ Yes.&lt;/p&gt;

&lt;p&gt;Efficient?&lt;/p&gt;

&lt;p&gt;❌ Not really.&lt;/p&gt;

&lt;p&gt;Every time the window moves...&lt;/p&gt;

&lt;p&gt;We're recalculating values we already know.&lt;/p&gt;

&lt;p&gt;Time Complexity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;O(n²)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🤔 Imagine This...
&lt;/h2&gt;

&lt;p&gt;Imagine you're sitting beside a train window.&lt;/p&gt;

&lt;p&gt;As the train moves...&lt;/p&gt;

&lt;p&gt;Do you look at the entire city again?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;You only notice:&lt;/p&gt;

&lt;p&gt;🚆 What's leaving your view.&lt;/p&gt;

&lt;p&gt;🚆 What's entering your view.&lt;/p&gt;

&lt;p&gt;That's exactly how the &lt;strong&gt;Sliding Window&lt;/strong&gt; pattern works.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 The Better Approach
&lt;/h2&gt;

&lt;p&gt;Instead of calculating everything again...&lt;/p&gt;

&lt;p&gt;Keep the current sum.&lt;/p&gt;

&lt;p&gt;When the window moves:&lt;/p&gt;

&lt;p&gt;➖ Remove the left element.&lt;/p&gt;

&lt;p&gt;➕ Add the new right element.&lt;/p&gt;

&lt;p&gt;That's it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;window_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;max_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;

    &lt;span class="n"&gt;window_sum&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;max_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_sum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;window_sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;window_sum&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look closely.&lt;/p&gt;

&lt;p&gt;No nested loops.&lt;/p&gt;

&lt;p&gt;Just two pointers working together.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 What's Really Happening?
&lt;/h2&gt;

&lt;p&gt;Every iteration does only two things:&lt;/p&gt;

&lt;p&gt;✅ Add one element.&lt;/p&gt;

&lt;p&gt;✅ Remove one element.&lt;/p&gt;

&lt;p&gt;The window keeps sliding.&lt;/p&gt;

&lt;p&gt;No repeated work.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ Why is it Faster?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Brute Force
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For every index
      ↓
Calculate the whole window again
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Time Complexity&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;O(n²)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Sliding Window
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Move Right →
Remove Left ←
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every element is visited only once.&lt;/p&gt;

&lt;p&gt;Time Complexity&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;O(n)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a massive improvement.&lt;/p&gt;




&lt;h2&gt;
  
  
  💼 Interview Insight
&lt;/h2&gt;

&lt;p&gt;Whenever you see words like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subarray&lt;/li&gt;
&lt;li&gt;Substring&lt;/li&gt;
&lt;li&gt;Contiguous&lt;/li&gt;
&lt;li&gt;Window size &lt;code&gt;k&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Longest&lt;/li&gt;
&lt;li&gt;Shortest&lt;/li&gt;
&lt;li&gt;Maximum&lt;/li&gt;
&lt;li&gt;Minimum&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🚨 Pause.&lt;/p&gt;

&lt;p&gt;Before writing nested loops...&lt;/p&gt;

&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Can I slide a window instead?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Many interview questions become much simpler with this mindset.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Quick Challenge
&lt;/h2&gt;

&lt;p&gt;Can you solve this using Sliding Window?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Find the maximum sum of a subarray of size &lt;strong&gt;3&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👇 Drop your answer in the comments before running the code.&lt;/p&gt;

&lt;p&gt;Bonus Question:&lt;/p&gt;

&lt;p&gt;Can you think of another problem where Sliding Window can replace nested loops?&lt;/p&gt;




&lt;h2&gt;
  
  
  🏏 Cover Drive of the Day
&lt;/h2&gt;

&lt;p&gt;🏏 &lt;strong&gt;Pattern:&lt;/strong&gt; Sliding Window&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;Mindset:&lt;/strong&gt; Don't recalculate. Slide.&lt;/p&gt;

&lt;p&gt;🧠 &lt;strong&gt;Memory Trick:&lt;/strong&gt; Train Window / Cricket Camera&lt;/p&gt;

&lt;p&gt;💼 &lt;strong&gt;Interview Insight:&lt;/strong&gt; Whenever you see contiguous arrays or substrings, think Sliding Window before nested loops.&lt;/p&gt;

&lt;p&gt;⏭️ &lt;strong&gt;Next Innings:&lt;/strong&gt; Two Pointers — Two indices. One elegant solution.&lt;/p&gt;




&lt;h3&gt;
  
  
  💬 Let's Discuss
&lt;/h3&gt;

&lt;p&gt;When did the &lt;strong&gt;Sliding Window&lt;/strong&gt; pattern finally click for you?&lt;/p&gt;

&lt;p&gt;Or...&lt;/p&gt;

&lt;p&gt;Are you still getting confused between &lt;strong&gt;Sliding Window&lt;/strong&gt; and &lt;strong&gt;Two Pointers&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;Let's discuss in the comments! 👇&lt;/p&gt;




&lt;p&gt;If you enjoyed this post and want to follow my 18-Day DSA Cover Drive journey, let's connect!&lt;/p&gt;

&lt;p&gt;💼 LinkedIn: &lt;a href="https://www.linkedin.com/in/PreethiiV" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/PreethiiV&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding! 🚀&lt;/p&gt;

&lt;p&gt;18DayDSACoverDrive | Python | DSA | Algorithms | Beginners&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>beginners</category>
      <category>computerscience</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🏏 The 18-Day DSA Cover Drive | Day 2: Meet Python's Counter</title>
      <dc:creator>Preethii V</dc:creator>
      <pubDate>Wed, 01 Jul 2026 17:55:58 +0000</pubDate>
      <link>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-2-meet-pythons-counter-25p5</link>
      <guid>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-2-meet-pythons-counter-25p5</guid>
      <description>&lt;h2&gt;
  
  
  🏏 The 18-Day DSA Cover Drive |    Day 2 — Meet &lt;code&gt;Counter&lt;/code&gt;
&lt;/h2&gt;




&lt;h3&gt;
  
  
  Learn DSA one Python trick at a time.
&lt;/h3&gt;

&lt;p&gt;What's up, DEV community! 👋&lt;/p&gt;

&lt;p&gt;Welcome back to &lt;strong&gt;Day 2&lt;/strong&gt; of &lt;strong&gt;The 18-Day DSA Cover Drive&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏆 Kohli Corner
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Fastest to 8,000 ODI Runs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Virat Kohli didn't score 8,000 ODI runs in a single innings.&lt;/p&gt;

&lt;p&gt;He reached the milestone by scoring &lt;strong&gt;one run at a time&lt;/strong&gt;, trusting the process, and showing up consistently.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Just like great innings are built one run at a time, great code is built one improvement at a time.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  📊 Day 2 — Meet &lt;code&gt;Counter&lt;/code&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  🎯 Today's Python Power-Up
&lt;/h2&gt;

&lt;p&gt;Yesterday, we learned how to build a &lt;strong&gt;Frequency Map&lt;/strong&gt; manually.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;freq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works.&lt;/p&gt;

&lt;p&gt;It's clean.&lt;/p&gt;

&lt;p&gt;But Python says...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Why write four lines when one line is enough?"&lt;/strong&gt; 😄&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Meet &lt;strong&gt;&lt;code&gt;Counter&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✨ The Magic Line
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt;

&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;freq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it!&lt;/p&gt;

&lt;p&gt;No loop.&lt;/p&gt;

&lt;p&gt;No &lt;code&gt;.get()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;No &lt;code&gt;if-else&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Just one line.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤔 Imagine This...
&lt;/h2&gt;

&lt;p&gt;Your teacher asks,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"How many students are wearing blue?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  ❌ Yesterday's Way
&lt;/h3&gt;

&lt;p&gt;You walk around the classroom and count everyone manually.&lt;/p&gt;

&lt;p&gt;Again.&lt;/p&gt;

&lt;p&gt;Again.&lt;/p&gt;

&lt;p&gt;Again.&lt;/p&gt;




&lt;h3&gt;
  
  
  ✅ Today's Way
&lt;/h3&gt;

&lt;p&gt;The teacher presses a button on a smart attendance machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Blue  → 8
Black → 12
White → 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instant result.&lt;/p&gt;

&lt;p&gt;That's exactly what &lt;strong&gt;&lt;code&gt;Counter&lt;/code&gt;&lt;/strong&gt; does.&lt;/p&gt;




&lt;h2&gt;
  
  
  ❌ Before
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;freq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ✅ After
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt;

&lt;span class="n"&gt;freq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Cleaner&lt;/p&gt;

&lt;p&gt;✅ Smaller&lt;/p&gt;

&lt;p&gt;✅ More Pythonic&lt;/p&gt;




&lt;h1&gt;
  
  
  🚀 Bonus Powers of &lt;code&gt;Counter&lt;/code&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Count a specific element
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Find the most frequent element
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;most_common&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pretty cool, right? 😄&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Where is &lt;code&gt;Counter&lt;/code&gt; useful?
&lt;/h2&gt;

&lt;p&gt;You'll commonly use it in problems like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finding duplicate elements&lt;/li&gt;
&lt;li&gt;Counting character frequencies&lt;/li&gt;
&lt;li&gt;Valid Anagram&lt;/li&gt;
&lt;li&gt;Majority Element&lt;/li&gt;
&lt;li&gt;Top K Frequent Elements&lt;/li&gt;
&lt;li&gt;Frequency-based array problems&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚡ Interview Insight
&lt;/h2&gt;

&lt;p&gt;Should you always use &lt;code&gt;Counter&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Use &lt;code&gt;Counter&lt;/code&gt;&lt;/strong&gt; when the problem is mainly about counting frequencies.&lt;/p&gt;

&lt;p&gt;❌ &lt;strong&gt;Don't immediately use &lt;code&gt;Counter&lt;/code&gt;&lt;/strong&gt; if an interviewer specifically asks you to implement the frequency map yourself.&lt;/p&gt;

&lt;p&gt;Understanding &lt;strong&gt;how &lt;code&gt;Counter&lt;/code&gt; works internally&lt;/strong&gt; (which we learned on Day 1 using &lt;code&gt;dict.get()&lt;/code&gt;) is just as important as knowing the shortcut.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;First learn the logic. Then learn the shortcut.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🧠 Quick Challenge
&lt;/h2&gt;

&lt;p&gt;Without running the code...&lt;/p&gt;

&lt;p&gt;Can you guess the output?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt;

&lt;span class="n"&gt;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mississippi&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;freq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;s&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;most_common&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👇 Drop your answer in the comments before checking!&lt;/p&gt;

&lt;h3&gt;
  
  
  🎯 Bonus Question
&lt;/h3&gt;

&lt;p&gt;Can you think of another DSA problem where &lt;code&gt;Counter&lt;/code&gt; can replace an entire counting loop?&lt;/p&gt;

&lt;p&gt;I'd love to hear your answers!&lt;/p&gt;




&lt;h2&gt;
  
  
  🏏 Cover Drive of the Day
&lt;/h2&gt;

&lt;p&gt;🏏 &lt;strong&gt;Concept:&lt;/strong&gt; &lt;code&gt;Counter&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;Python Gem:&lt;/strong&gt; &lt;code&gt;collections.Counter&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;💼 &lt;strong&gt;Interview Insight:&lt;/strong&gt; Learn the logic first, then use the shortcut.&lt;/p&gt;

&lt;p&gt;⏭️ &lt;strong&gt;Next Innings:&lt;/strong&gt; &lt;code&gt;defaultdict&lt;/code&gt; — A dictionary that creates missing keys automatically.&lt;/p&gt;




&lt;h3&gt;
  
  
  💬 Let's Discuss
&lt;/h3&gt;

&lt;p&gt;Have you used &lt;strong&gt;&lt;code&gt;Counter&lt;/code&gt;&lt;/strong&gt; before?&lt;/p&gt;

&lt;p&gt;Or did you learn something new today?&lt;/p&gt;

&lt;p&gt;If you know another hidden Python gem that makes DSA easier, drop it in the comments! 👇&lt;/p&gt;




&lt;p&gt;18DayDSACoverDrive | Python | DSA | Beginners | Learning&lt;/p&gt;

</description>
      <category>python</category>
      <category>begineers</category>
      <category>learning</category>
      <category>coding</category>
    </item>
    <item>
      <title>The 18-Day DSA Cover Drive: Day 1 — Unleashing the Frequency Map 🏏</title>
      <dc:creator>Preethii V</dc:creator>
      <pubDate>Tue, 30 Jun 2026 16:54:54 +0000</pubDate>
      <link>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-1-unleashing-the-frequency-map-50go</link>
      <guid>https://dev.to/preethii_v_192006/the-18-day-dsa-cover-drive-day-1-unleashing-the-frequency-map-50go</guid>
      <description>&lt;h1&gt;
  
  
  🏏 The 18-Day DSA Cover Drive
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Learn DSA one Python trick at a time.
&lt;/h3&gt;

&lt;p&gt;What's up, DEV community! 👋&lt;/p&gt;

&lt;p&gt;Welcome to &lt;strong&gt;Day 1&lt;/strong&gt; of my brand-new coding series.&lt;/p&gt;

&lt;p&gt;If you're wondering why it's called &lt;strong&gt;The 18-Day DSA Cover Drive&lt;/strong&gt;, let me let you in on a secret...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I'm a massive Virat Kohli fan. 🤫&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffn5f77r9uukl3uuc2lmb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffn5f77r9uukl3uuc2lmb.jpg" alt="Virat Kohli" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Just like a perfect cover drive isn't built in one net session, strong DSA isn't built in one night.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For the next &lt;strong&gt;18 days&lt;/strong&gt;, I'll share:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🐍 One Python trick&lt;/li&gt;
&lt;li&gt;🧩 One DSA lesson&lt;/li&gt;
&lt;li&gt;❌ One mistake I made&lt;/li&gt;
&lt;li&gt;🧠 One memory trick to remember it forever&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqeunq8n86u9ajurw44hn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqeunq8n86u9ajurw44hn.jpg" alt="virat kohli" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A perfect cover drive isn't born on match day. An optimal solution isn't born during interviews. Both are built in practice.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  📊 Day 1 — Frequency Count
&lt;/h1&gt;

&lt;h2&gt;
  
  
  🎯 Today's Hidden Gem
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks simple.&lt;/p&gt;

&lt;p&gt;But this single line can turn an &lt;strong&gt;O(n²)&lt;/strong&gt; solution into an &lt;strong&gt;O(n)&lt;/strong&gt; solution.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤔 Imagine this...
&lt;/h2&gt;

&lt;p&gt;You walk into your classroom.&lt;/p&gt;

&lt;p&gt;The teacher asks,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"How many students are wearing blue?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  ❌ Method 1
&lt;/h3&gt;

&lt;p&gt;Every time someone asks, you walk around the entire classroom counting students.&lt;/p&gt;

&lt;p&gt;Again.&lt;/p&gt;

&lt;p&gt;Again.&lt;/p&gt;

&lt;p&gt;Again.&lt;/p&gt;

&lt;p&gt;Sounds exhausting?&lt;/p&gt;

&lt;p&gt;That's exactly what &lt;strong&gt;nested loops&lt;/strong&gt; do.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Method 2
&lt;/h3&gt;

&lt;p&gt;Walk through the classroom &lt;strong&gt;once&lt;/strong&gt; and maintain a notebook.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Blue  → 8
Black → 12
White → 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now every answer takes just a second.&lt;/p&gt;

&lt;p&gt;That's the idea behind &lt;strong&gt;Frequency Count&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎬 Movie Memory Trick
&lt;/h2&gt;

&lt;p&gt;Think of &lt;strong&gt;Doraemon's Anywhere Door&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Without a dictionary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🚶 Search the whole house.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With a dictionary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🚪 Open the door.&lt;/p&gt;

&lt;p&gt;You're already there.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✨ The Magic Line
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read it like English.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get the current count.&lt;/li&gt;
&lt;li&gt;If it doesn't exist, assume it's &lt;strong&gt;0&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;1&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Save it back.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Done.&lt;/p&gt;




&lt;h2&gt;
  
  
  Before
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  After
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Cleaner&lt;/p&gt;

&lt;p&gt;✅ Smaller&lt;/p&gt;

&lt;p&gt;✅ Easier&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Quick Challenge
&lt;/h2&gt;

&lt;p&gt;What will be the output?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;freq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;freq&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👇 Put your answer in the comments &lt;strong&gt;before running the code!&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🏏 Cover Drive of the Day
&lt;/h2&gt;

&lt;p&gt;🏏 &lt;strong&gt;Concept:&lt;/strong&gt; Frequency Count&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;Python Gem:&lt;/strong&gt; &lt;code&gt;dict.get()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;🧠 &lt;strong&gt;Memory Trick:&lt;/strong&gt; Classroom Attendance Notebook&lt;/p&gt;

&lt;p&gt;⏭️ &lt;strong&gt;Next Innings:&lt;/strong&gt; &lt;code&gt;defaultdict&lt;/code&gt; (Less code. Same logic. Even cleaner.)&lt;/p&gt;




&lt;p&gt;18DayDSACoverDrive | Python | DSA | Beginners Learning &lt;/p&gt;

</description>
      <category>python</category>
      <category>learning</category>
      <category>beginners</category>
      <category>coding</category>
    </item>
    <item>
      <title>"Talk to Your Terminal: Building a Voice AI Agent in Python"</title>
      <dc:creator>Preethii V</dc:creator>
      <pubDate>Sun, 12 Apr 2026 19:58:21 +0000</pubDate>
      <link>https://dev.to/preethii_v_192006/talk-to-your-terminal-building-a-voice-ai-agent-in-python-51bm</link>
      <guid>https://dev.to/preethii_v_192006/talk-to-your-terminal-building-a-voice-ai-agent-in-python-51bm</guid>
      <description>&lt;p&gt;Have you ever wished your computer could understand your voice and do tasks for you?&lt;/p&gt;

&lt;p&gt;I decided to build a simple Voice AI Agent in Python that can listen to my voice, understand what I want, and perform actions automatically.&lt;/p&gt;

&lt;p&gt;For example, I can say:&lt;/p&gt;

&lt;p&gt;"Create a file called notes.txt"&lt;/p&gt;

&lt;p&gt;"Write a Python binary search program"&lt;/p&gt;

&lt;p&gt;"Summarize this text"&lt;/p&gt;

&lt;p&gt;"What is machine learning?"&lt;/p&gt;

&lt;p&gt;And the AI takes care of the rest!&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does It Work?
&lt;/h2&gt;

&lt;p&gt;The workflow is surprisingly simple:&lt;/p&gt;

&lt;p&gt;🎤 Speak&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;👂 AI listens&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;🧠 AI understands&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;p&gt;⚡ AI performs the task&lt;/p&gt;

&lt;p&gt;↓&lt;/p&gt;

&lt;h2&gt;
  
  
  The Technologies I Used
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Whisper
&lt;/h3&gt;

&lt;p&gt;Whisper converts my voice into text.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Voice:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Create a file called test.txt"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Text:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Create a file called test.txt"&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  GPT-4o-mini / Ollama
&lt;/h3&gt;

&lt;p&gt;Once the speech becomes text, the AI figures out what I actually want.&lt;/p&gt;

&lt;p&gt;Is it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a file?&lt;/li&gt;
&lt;li&gt;Generating code?&lt;/li&gt;
&lt;li&gt;Summarizing text?&lt;/li&gt;
&lt;li&gt;Answering a question?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The AI decides and chooses the correct action.&lt;/p&gt;

&lt;h3&gt;
  
  
  Streamlit
&lt;/h3&gt;

&lt;p&gt;I used Streamlit to build a simple and clean web interface.&lt;/p&gt;

&lt;p&gt;This lets me upload audio files and see the results instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Can It Do?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📁 Create Files
&lt;/h3&gt;

&lt;p&gt;Say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Create a file called project_notes.txt"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent creates the file automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  💻 Generate Code
&lt;/h3&gt;

&lt;p&gt;Say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Write a Python bubble sort program"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The AI generates the code and saves it.&lt;/p&gt;

&lt;h3&gt;
  
  
  📝 Summarize Text
&lt;/h3&gt;

&lt;p&gt;Have a long paragraph?&lt;/p&gt;

&lt;p&gt;Just say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Summarize this"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The AI gives a shorter version.&lt;/p&gt;

&lt;h3&gt;
  
  
  💬 Answer Questions
&lt;/h3&gt;

&lt;p&gt;You can also ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What is a linked list?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And get an explanation immediately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges I Faced
&lt;/h2&gt;

&lt;p&gt;Building it wasn't as smooth as I expected 😅&lt;/p&gt;

&lt;h3&gt;
  
  
  Windows File Issues
&lt;/h3&gt;

&lt;p&gt;Sometimes Windows locked temporary audio files, preventing Whisper from reading them.&lt;/p&gt;

&lt;p&gt;After a lot of debugging, I discovered the file needed to be closed before processing.&lt;/p&gt;

&lt;h3&gt;
  
  
  FFmpeg Problems
&lt;/h3&gt;

&lt;p&gt;Whisper requires FFmpeg.&lt;/p&gt;

&lt;p&gt;The funny part?&lt;/p&gt;

&lt;p&gt;I had installed FFmpeg correctly, but forgot to add it to the system PATH.&lt;/p&gt;

&lt;p&gt;A classic developer mistake 😂&lt;/p&gt;

&lt;h3&gt;
  
  
  Offline Support
&lt;/h3&gt;

&lt;p&gt;What if the internet is unavailable?&lt;/p&gt;

&lt;p&gt;To solve this, I added Ollama and fallback rules so the agent can still work without cloud APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Project Excited Me
&lt;/h2&gt;

&lt;p&gt;The coolest part wasn't the code.&lt;/p&gt;

&lt;p&gt;It was the first time I spoke to my application and watched it actually understand me and perform a task.&lt;/p&gt;

&lt;p&gt;That moment felt like talking to a mini personal assistant I had built myself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This project showed me that building AI-powered tools is becoming more accessible than ever.&lt;/p&gt;

&lt;p&gt;With Python, Whisper, Streamlit, and an LLM, you can create your own voice assistant capable of performing useful tasks in just a few hundred lines of code.&lt;/p&gt;

&lt;p&gt;And honestly...&lt;/p&gt;

&lt;p&gt;There's something satisfying about telling your computer what to do instead of typing it. 🎙️&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub Repository
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/Preethii19V/Voice-AI-Agent" rel="noopener noreferrer"&gt;https://github.com/Preethii19V/Voice-AI-Agent&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>coding</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
