<?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: Prakhar Srivastava</title>
    <description>The latest articles on DEV Community by Prakhar Srivastava (@prakhar_srv).</description>
    <link>https://dev.to/prakhar_srv</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3909129%2F5c563cfe-658c-4e09-a767-f5e320af4e2c.jpeg</url>
      <title>DEV Community: Prakhar Srivastava</title>
      <link>https://dev.to/prakhar_srv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prakhar_srv"/>
    <language>en</language>
    <item>
      <title>I Solved 200 LeetCode Problems and Still Froze in Interviews</title>
      <dc:creator>Prakhar Srivastava</dc:creator>
      <pubDate>Sun, 03 May 2026 16:27:58 +0000</pubDate>
      <link>https://dev.to/codeintuition/i-solved-200-leetcode-problems-and-still-froze-in-interviews-1hoj</link>
      <guid>https://dev.to/codeintuition/i-solved-200-leetcode-problems-and-still-froze-in-interviews-1hoj</guid>
      <description>&lt;p&gt;A few years ago I solved 200 LeetCode problems and still froze on Mediums I hadn't seen. The breakthrough wasn't another hundred problems. It was a different loop.&lt;/p&gt;

&lt;p&gt;A problem asks for the longest substring with at most K distinct characters. You've solved sliding window before. Maximum sum subarray of size K, done. Longest substring without repeating characters, done. This third one stalls you. Twenty minutes pass. Discuss says sliding window. You'd already solved sliding window problems. The recognition didn't work on this one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Practice volume builds memory of specific problems, not the recognition you have to do before you start coding. The skill that transfers to unfamiliar interview mediums is identifying which technique applies from what the problem looks like. That recognition is what most LeetCode-style prep doesn't train, and that gap is what this post is about.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What LeetCode actually does well
&lt;/h2&gt;

&lt;p&gt;LeetCode is the default coding interview prep platform for a reason. The problem bank is the strongest available: 3,000+ problems across every common data structure, tagged by company and frequency. The company tagging is the most reliable public signal you can get for "what does Amazon currently ask." Nothing else is close on that dimension.&lt;/p&gt;

&lt;p&gt;The free tier is generous, the discuss forum is open, and the weekly contests are free. If you already understand the underlying patterns and you need volume to drill them, LeetCode is the right platform. The contest system is genuinely underrated for building speed under time. Top voted discuss replies on popular problems also hold up. They often explain the reasoning more clearly than the official editorials.&lt;/p&gt;

&lt;p&gt;So the question isn't whether LeetCode is good. It is good. The real question is whether the thing holding you back is the kind of thing LeetCode's design actually fixes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The gap volume doesn't close
&lt;/h2&gt;

&lt;p&gt;The earlier sliding window problems taught implementation on those specific problems, not the rule for when sliding window applies. The connection between "K distinct characters" and "variable sliding window" was never made explicit anywhere in your prep. You learned an implementation by example, not a recognition rule. When the visible parts of the problem change, the implementation memory doesn't carry over.&lt;/p&gt;

&lt;p&gt;Learning research calls this near transfer versus far transfer. Near transfer means solving problems that look like ones you've already solved. Far transfer means reasoning through problems that look different but follow the same underlying pattern. The Wikipedia article on &lt;a href="https://en.wikipedia.org/wiki/Transfer_of_learning" rel="noopener noreferrer"&gt;transfer of learning&lt;/a&gt; covers it. The short version: practice volume produces near transfer reliably and far transfer unreliably. You can grind 500 problems and still not generalise across the differences in description if no one ever taught you which features signal which pattern.&lt;/p&gt;

&lt;p&gt;That isn't a talent gap. It's a gap in the method.&lt;/p&gt;

&lt;h2&gt;
  
  
  What recognition actually looks like
&lt;/h2&gt;

&lt;p&gt;Recognition is reading a problem statement, naming the visible features, and matching them to a technique before any code is written. Every technique has a small set of trigger conditions, usually three to five. When all of them match, you've identified the technique.&lt;/p&gt;

&lt;p&gt;For variable sliding window, the trigger conditions are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The input is a contiguous range (a substring, a subarray, a window of consecutive elements).&lt;/li&gt;
&lt;li&gt;The optimisation target is the length of that range (longest, shortest, smallest valid).&lt;/li&gt;
&lt;li&gt;There is a condition you can check incrementally as the window expands or contracts (count of distinct characters, sum within bounds, set membership).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When all three apply, variable sliding window is the technique. K distinct characters hits all three. So does longest substring without repeating characters. So does minimum window substring. The triggers are the same. The descriptions differ.&lt;/p&gt;

&lt;p&gt;The skill is matching problems to triggers before coding. That's what doesn't get built by grinding problems sequentially.&lt;/p&gt;

&lt;h2&gt;
  
  
  A code template you can adapt
&lt;/h2&gt;

&lt;p&gt;Here's the variable sliding window template in Python. Once you recognise the technique, the implementation has very few moving parts.&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;variable_window&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;condition&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;0&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;init_state&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;best&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;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;expand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&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;right&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;shrink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&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;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;span class="n"&gt;best&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;best&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&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;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;best&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For K distinct characters, &lt;code&gt;state&lt;/code&gt; is a hash map of character counts within the current window, &lt;code&gt;condition&lt;/code&gt; is &lt;code&gt;len(state) &amp;lt;= K&lt;/code&gt;, and &lt;code&gt;shrink&lt;/code&gt; decrements counts and removes keys whose count drops to zero. The recognition step (this is variable sliding window) is the decision that matters. The code follows.&lt;/p&gt;

&lt;p&gt;For longest substring without repeating characters, &lt;code&gt;state&lt;/code&gt; becomes a hash set and &lt;code&gt;condition&lt;/code&gt; is "no duplicate." Same skeleton. Same invariant.&lt;/p&gt;

&lt;p&gt;That's the payoff of recognition trained explicitly. Write the template once. Adapt per problem in two or three lines. Stop staring at problems hoping the right approach surfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  How practice and interview conditions diverge
&lt;/h2&gt;

&lt;p&gt;Recognition is half the gap. The other half is the conditions you practise under. LeetCode's practice environment shows you the problem name (which often hints at the technique), gives unlimited code executions, and doesn't penalise failed attempts. Real interviews give none of that.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Practice (LeetCode default)&lt;/th&gt;
&lt;th&gt;Real interview&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Problem name&lt;/td&gt;
&lt;td&gt;Visible, often hints at category&lt;/td&gt;
&lt;td&gt;Not given&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code executions&lt;/td&gt;
&lt;td&gt;Unlimited, no penalty&lt;/td&gt;
&lt;td&gt;Limited, every failure costs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hints / discuss&lt;/td&gt;
&lt;td&gt;One click away&lt;/td&gt;
&lt;td&gt;Not available&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time limit&lt;/td&gt;
&lt;td&gt;Self set, often skipped&lt;/td&gt;
&lt;td&gt;20 to 45 minutes hard&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reasoning&lt;/td&gt;
&lt;td&gt;Internal&lt;/td&gt;
&lt;td&gt;Spoken aloud&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The middle column is fine for the early learning phase. Open exploration helps when you're still building the model. The problem comes when those conditions are the only conditions you ever rehearse under, and the actual test wants something the rehearsal never asked for.&lt;/p&gt;

&lt;p&gt;Replicating interview pressure on your own takes one friend and a kitchen timer. The friend covers the problem name and reads the constraints aloud. You set the timer to 20 or 30 minutes. You don't open the IDE before stating the technique you intend to use. Two sessions a week against a friend who isn't shy about silence will do more for interview readiness than another fifty problems on the comfort setting.&lt;/p&gt;

&lt;h2&gt;
  
  
  A protocol you can run this week
&lt;/h2&gt;

&lt;p&gt;If the K distinct characters story sounded like your last three failed problems, the move isn't more volume. It's a tighter loop on recognition first.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick one technique a week (variable sliding window, two pointers, prefix sum, monotonic stack, and so on).&lt;/li&gt;
&lt;li&gt;Write down the trigger conditions for that technique. Three to five features of the problem that, when they all apply, make this technique the right tool. Write them in your own words, not from a cheat sheet.&lt;/li&gt;
&lt;li&gt;Read five problems that use this technique without solving them. For each, name the triggers you can see in the problem statement before reading the constraints in detail.&lt;/li&gt;
&lt;li&gt;Solve three to five problems on this technique with the problem name and tag hidden. Force the recognition step.&lt;/li&gt;
&lt;li&gt;Once a week, do one timed pressure session: friend covers the title, you talk through your reasoning, no IDE until you've named the technique. If you can't name it inside five minutes, the problem rewinds to the recognition queue, not the implementation queue.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A pattern a week, eight to ten patterns covered, roughly ten weeks of focused work. That replaces the hundreds of mediums where the signal gets buried under details that don't matter.&lt;/p&gt;

&lt;p&gt;The longer write up of this is on &lt;a href="https://www.codeintuition.io/blogs/codeintuition-vs-leetcode" rel="noopener noreferrer"&gt;my own blog&lt;/a&gt;, with trigger conditions for prefix sum, two pointers, and monotonic stack alongside the variable sliding window walkthrough above, plus a worked example on minimum window substring that uses the same template.&lt;/p&gt;

&lt;p&gt;When did the recognition click for a pattern you used to grind without seeing, and what was the specific problem that broke it open?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: I built Codeintuition, a structured learning platform for coding interviews. The post above is about the technique, not the platform.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>leetcode</category>
      <category>career</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
