<?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: Arman Phaugat</title>
    <description>The latest articles on DEV Community by Arman Phaugat (@armanphaugat).</description>
    <link>https://dev.to/armanphaugat</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%2F3751983%2F9bcc5648-b4c7-4556-aac2-a346a3f4a531.jpg</url>
      <title>DEV Community: Arman Phaugat</title>
      <link>https://dev.to/armanphaugat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/armanphaugat"/>
    <language>en</language>
    <item>
      <title>712 Problems Later: What 500+ Days of DSA Really Taught Me</title>
      <dc:creator>Arman Phaugat</dc:creator>
      <pubDate>Wed, 04 Feb 2026 06:28:17 +0000</pubDate>
      <link>https://dev.to/armanphaugat/712-problems-later-what-500-days-of-dsa-really-taught-me-8ib</link>
      <guid>https://dev.to/armanphaugat/712-problems-later-what-500-days-of-dsa-really-taught-me-8ib</guid>
      <description>&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.amazonaws.com%2Fuploads%2Farticles%2F9vg99gndo06zxgo2ylzo.png" 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.amazonaws.com%2Fuploads%2Farticles%2F9vg99gndo06zxgo2ylzo.png" alt=" " width="800" height="375"&gt;&lt;/a&gt;&lt;br&gt;
When I started solving DSA problems, I didn’t plan to reach 700+.&lt;/p&gt;

&lt;p&gt;I just wanted to get better.&lt;/p&gt;

&lt;p&gt;One problem a day.&lt;/p&gt;

&lt;p&gt;That was the goal.&lt;/p&gt;

&lt;p&gt;Today, my stats look like this:&lt;/p&gt;

&lt;p&gt;712 problems solved&lt;/p&gt;

&lt;p&gt;1,030 submissions in the past year&lt;/p&gt;

&lt;p&gt;325 active days&lt;/p&gt;

&lt;p&gt;124 days max streak&lt;/p&gt;

&lt;p&gt;500 Days Badge&lt;/p&gt;

&lt;p&gt;455 Medium problems&lt;/p&gt;

&lt;p&gt;29 Hard problems&lt;/p&gt;

&lt;p&gt;But the numbers aren’t the story.&lt;/p&gt;

&lt;p&gt;The journey is.&lt;/p&gt;

&lt;p&gt;The First 100 Problems – Excitement Phase&lt;/p&gt;

&lt;p&gt;The beginning is fun.&lt;/p&gt;

&lt;p&gt;You solve Easy array problems.&lt;br&gt;
You feel smart.&lt;br&gt;
You think interviews will be easy.&lt;/p&gt;

&lt;p&gt;Then Medium problems hit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sliding window?&lt;br&gt;
Binary search on answer?&lt;br&gt;
Monotonic stack?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That’s when confidence drops.&lt;/p&gt;

&lt;p&gt;But that’s also where real growth starts.&lt;/p&gt;

&lt;p&gt;200–400 Problems – Pattern Recognition Begins&lt;/p&gt;

&lt;p&gt;Somewhere after 200 problems, something changes.&lt;/p&gt;

&lt;p&gt;You stop seeing random questions.&lt;/p&gt;

&lt;p&gt;You start seeing:&lt;/p&gt;

&lt;p&gt;“This is just two pointers.”&lt;/p&gt;

&lt;p&gt;“This is a variation of prefix sum.”&lt;/p&gt;

&lt;p&gt;“This smells like a monotonic stack.”&lt;/p&gt;

&lt;p&gt;You don’t panic anymore.&lt;/p&gt;

&lt;p&gt;You analyze.&lt;/p&gt;

&lt;p&gt;That shift is powerful.&lt;/p&gt;

&lt;p&gt;400–600 Problems – Discipline &amp;gt; Motivation&lt;/p&gt;

&lt;p&gt;This is where most people quit.&lt;/p&gt;

&lt;p&gt;Not because problems are hard.&lt;/p&gt;

&lt;p&gt;But because consistency is hard.&lt;/p&gt;

&lt;p&gt;325 active days means I showed up almost every day.&lt;/p&gt;

&lt;p&gt;Not always 5 problems.&lt;br&gt;
Sometimes just 1.&lt;/p&gt;

&lt;p&gt;But I showed up.&lt;/p&gt;

&lt;p&gt;Even when:&lt;/p&gt;

&lt;p&gt;College assignments were heavy&lt;/p&gt;

&lt;p&gt;Projects were pending&lt;/p&gt;

&lt;p&gt;I didn’t feel like solving anything&lt;/p&gt;

&lt;p&gt;Streaks build discipline.&lt;br&gt;
Discipline builds skill.&lt;/p&gt;

&lt;p&gt;The 124-Day Streak&lt;/p&gt;

&lt;p&gt;124 days in a row.&lt;/p&gt;

&lt;p&gt;That wasn’t about ego.&lt;/p&gt;

&lt;p&gt;It was about identity.&lt;/p&gt;

&lt;p&gt;I stopped asking:&lt;br&gt;
“Should I solve today?”&lt;/p&gt;

&lt;p&gt;It became:&lt;br&gt;
“I solve daily.”&lt;/p&gt;

&lt;p&gt;Small difference.&lt;br&gt;
Massive impact.&lt;/p&gt;

&lt;p&gt;The Reality About Hard Problems&lt;/p&gt;

&lt;p&gt;Only 29 Hard problems solved.&lt;/p&gt;

&lt;p&gt;And that’s okay.&lt;/p&gt;

&lt;p&gt;Because:&lt;/p&gt;

&lt;p&gt;Medium builds foundation&lt;/p&gt;

&lt;p&gt;Hard tests depth&lt;/p&gt;

&lt;p&gt;Hard problems forced me to:&lt;/p&gt;

&lt;p&gt;Think longer&lt;/p&gt;

&lt;p&gt;Break problems into parts&lt;/p&gt;

&lt;p&gt;Analyze time complexity carefully&lt;/p&gt;

&lt;p&gt;They humbled me.&lt;/p&gt;

&lt;p&gt;And I needed that.&lt;/p&gt;

&lt;p&gt;What 1,030 Submissions Actually Means&lt;/p&gt;

&lt;p&gt;It means:&lt;/p&gt;

&lt;p&gt;I failed.&lt;/p&gt;

&lt;p&gt;I debugged.&lt;/p&gt;

&lt;p&gt;I optimized.&lt;/p&gt;

&lt;p&gt;I resubmitted.&lt;/p&gt;

&lt;p&gt;A lot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DSA isn’t about getting AC in first try.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It’s about thinking until something clicks.&lt;/p&gt;

&lt;p&gt;How This Changed My Backend Thinking&lt;/p&gt;

&lt;p&gt;When I optimized my /leaderboard API from 200ms to 20ms,&lt;br&gt;
that mindset came from DSA.&lt;/p&gt;

&lt;p&gt;Because DSA trains you to ask:&lt;/p&gt;

&lt;p&gt;What’s the time complexity?&lt;/p&gt;

&lt;p&gt;Can I reduce this from O(n²) to O(n)?&lt;/p&gt;

&lt;p&gt;Can I remove unnecessary operations?&lt;/p&gt;

&lt;p&gt;Am I making N+1 calls?&lt;/p&gt;

&lt;p&gt;That optimization mindset didn’t come from tutorials.&lt;/p&gt;

&lt;p&gt;It came from solving hundreds of problems.&lt;/p&gt;

&lt;p&gt;The Biggest Lesson&lt;/p&gt;

&lt;p&gt;Consistency beats intensity.&lt;/p&gt;

&lt;p&gt;712 problems didn’t happen in one summer.&lt;/p&gt;

&lt;p&gt;They happened because I showed up 325 days.&lt;/p&gt;

&lt;p&gt;Some days:&lt;br&gt;
1 problem.&lt;/p&gt;

&lt;p&gt;Some days:&lt;br&gt;
5 problems.&lt;/p&gt;

&lt;p&gt;But never zero for too long.&lt;/p&gt;

&lt;p&gt;Where I Am Now&lt;/p&gt;

&lt;p&gt;I’m not perfect.&lt;/p&gt;

&lt;p&gt;I still get stuck.&lt;br&gt;
I still struggle with DP.&lt;br&gt;
I still spend 30 minutes staring at problems.&lt;/p&gt;

&lt;p&gt;But now I don’t doubt myself.&lt;/p&gt;

&lt;p&gt;Because I’ve built proof.&lt;/p&gt;

&lt;p&gt;712 pieces of proof.&lt;/p&gt;

&lt;p&gt;Final Thought&lt;/p&gt;

&lt;p&gt;If you’re starting DSA:&lt;/p&gt;

&lt;p&gt;Don’t aim for 1000 problems.&lt;/p&gt;

&lt;p&gt;Aim for tomorrow.&lt;/p&gt;

&lt;p&gt;Solve one.&lt;/p&gt;

&lt;p&gt;Then repeat.&lt;br&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.amazonaws.com%2Fuploads%2Farticles%2Fvrrlqekopuumg1avyap6.png" 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.amazonaws.com%2Fuploads%2Farticles%2Fvrrlqekopuumg1avyap6.png" alt=" " width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The streak builds.&lt;br&gt;
The patterns form.&lt;br&gt;
The confidence follows.&lt;/p&gt;

&lt;p&gt;**And one day, you’ll look back and realize—&lt;/p&gt;

&lt;p&gt;You didn’t just learn DSA.&lt;/p&gt;

&lt;p&gt;You trained your brain to think differently.**&lt;/p&gt;

</description>
      <category>programming</category>
      <category>softwaredevelopment</category>
      <category>coding</category>
      <category>leetcode</category>
    </item>
    <item>
      <title>Using Redis to Optimize Backend Queries</title>
      <dc:creator>Arman Phaugat</dc:creator>
      <pubDate>Wed, 04 Feb 2026 06:12:59 +0000</pubDate>
      <link>https://dev.to/armanphaugat/using-redis-to-optimize-backend-queries-n11</link>
      <guid>https://dev.to/armanphaugat/using-redis-to-optimize-backend-queries-n11</guid>
      <description>&lt;p&gt;How I Optimized My /leaderboard API from 200ms to 20ms Using Redis&lt;/p&gt;

&lt;p&gt;Performance issues don’t usually scream at you.&lt;/p&gt;

&lt;p&gt;They whisper.&lt;/p&gt;

&lt;p&gt;My /leaderboard endpoint was one of those whispers.&lt;/p&gt;

&lt;p&gt;It worked.&lt;br&gt;
It returned the top 10 players correctly.&lt;br&gt;
But under load… it felt slow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Around ~200ms per request.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not terrible.&lt;/p&gt;

&lt;p&gt;But not great either.&lt;/p&gt;

&lt;p&gt;And as someone building backend systems, I knew this would eventually become a bottleneck.&lt;/p&gt;

&lt;p&gt;So I decided to fix it.&lt;/p&gt;

&lt;p&gt;The Original Approach (The Comfortable One)&lt;/p&gt;

&lt;p&gt;The endpoint logic was simple:&lt;/p&gt;

&lt;p&gt;Query database&lt;/p&gt;

&lt;p&gt;Sort users by score&lt;/p&gt;

&lt;p&gt;Return top 10&lt;/p&gt;

&lt;p&gt;Classic.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;SELECT * FROM users ORDER BY score DESC LIMIT 10;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;With proper indexing, it worked fine at small scale.&lt;/p&gt;

&lt;p&gt;But leaderboards are:&lt;/p&gt;

&lt;p&gt;Frequently accessed&lt;/p&gt;

&lt;p&gt;Frequently updated&lt;/p&gt;

&lt;p&gt;Competitive, real-time data&lt;/p&gt;

&lt;p&gt;And hitting the database every single time didn’t feel right.&lt;/p&gt;

&lt;p&gt;I needed something faster.&lt;/p&gt;

&lt;p&gt;First Attempt: Let’s Use Redis&lt;/p&gt;

&lt;p&gt;Redis felt like the perfect fit.&lt;/p&gt;

&lt;p&gt;In-memory.&lt;br&gt;
Fast.&lt;br&gt;
Built for ranking.&lt;/p&gt;

&lt;p&gt;But here’s the twist.&lt;/p&gt;

&lt;p&gt;Redis wasn’t even working.&lt;/p&gt;

&lt;p&gt;When I tried starting it locally, I got:&lt;/p&gt;

&lt;p&gt;Error: Address already in use&lt;/p&gt;

&lt;p&gt;Port 6379 was already occupied.&lt;/p&gt;

&lt;p&gt;I tried restarting services.&lt;br&gt;
Killing processes.&lt;br&gt;
Nothing clean worked.&lt;/p&gt;

&lt;p&gt;Instead of wasting more time debugging system-level conflicts, I decided to isolate it properly.&lt;/p&gt;

&lt;p&gt;The Fix: Dockerizing Redis&lt;/p&gt;

&lt;p&gt;I ran:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;docker run -d -p 6379:6379 --name redis-server redis&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And that solved everything instantly.&lt;/p&gt;

&lt;p&gt;Now Redis was:&lt;/p&gt;

&lt;p&gt;Isolated&lt;/p&gt;

&lt;p&gt;Portable&lt;/p&gt;

&lt;p&gt;Cleanly running&lt;/p&gt;

&lt;p&gt;Easy to restart&lt;/p&gt;

&lt;p&gt;Sometimes the real optimization is fixing your environment first.&lt;/p&gt;

&lt;p&gt;Now I could finally move forward.&lt;/p&gt;

&lt;p&gt;Enter Sorted Sets (ZSET)&lt;/p&gt;

&lt;p&gt;Redis has a powerful data structure called Sorted Sets (ZSET).&lt;/p&gt;

&lt;p&gt;Each entry has:&lt;/p&gt;

&lt;p&gt;A member (user ID)&lt;/p&gt;

&lt;p&gt;A score (points)&lt;/p&gt;

&lt;p&gt;Redis automatically keeps them sorted by score.&lt;/p&gt;

&lt;p&gt;That meant I no longer needed:&lt;/p&gt;

&lt;p&gt;SQL sorting&lt;/p&gt;

&lt;p&gt;ORDER BY queries&lt;/p&gt;

&lt;p&gt;Heavy DB reads&lt;/p&gt;

&lt;p&gt;When a user’s score updates:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;await redis.zadd("leaderboard", score, userId);&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To fetch top 10:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;await redis.zrevrange("leaderboard", 0, 9, "WITHSCORES");&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now the ranking logic lived entirely in memory.&lt;/p&gt;

&lt;p&gt;Latency improved immediately.&lt;/p&gt;

&lt;p&gt;But something still felt off.&lt;/p&gt;

&lt;p&gt;The Hidden Bottleneck I Didn’t See Coming&lt;/p&gt;

&lt;p&gt;After fetching the top 10 user IDs, I needed user details:&lt;/p&gt;

&lt;p&gt;username&lt;/p&gt;

&lt;p&gt;avatar&lt;/p&gt;

&lt;p&gt;level&lt;/p&gt;

&lt;p&gt;metadata&lt;/p&gt;

&lt;p&gt;So I wrote:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;for (let userId of topUsers) {&lt;br&gt;
  await redis.hgetall(&lt;code&gt;user:${userId}&lt;/code&gt;);&lt;br&gt;
}&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;But performance wasn’t where I expected it to be.&lt;/p&gt;

&lt;p&gt;Then it hit me.&lt;/p&gt;

&lt;p&gt;I had recreated the N+1 problem.&lt;/p&gt;

&lt;p&gt;Not in the database.&lt;/p&gt;

&lt;p&gt;In Redis.&lt;/p&gt;

&lt;p&gt;Here’s what was happening:&lt;/p&gt;

&lt;p&gt;**1 request → fetch leaderboard&lt;/p&gt;

&lt;p&gt;10 requests → fetch each user&lt;/p&gt;

&lt;p&gt;That’s 11 network round trips.**&lt;/p&gt;

&lt;p&gt;Even if Redis responds in microseconds, network latency doesn’t.&lt;/p&gt;

&lt;p&gt;That’s where my missing 100ms was hiding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Real Fix: Redis Pipelining&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Redis supports pipelining.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;/p&gt;

&lt;p&gt;request → response&lt;br&gt;
request → response&lt;br&gt;
request → response&lt;/p&gt;

&lt;p&gt;You send all commands together and receive all responses together.&lt;/p&gt;

&lt;p&gt;So I rewrote it:&lt;/p&gt;

&lt;p&gt;_**const pipeline = redis.pipeline();&lt;/p&gt;

&lt;p&gt;for (let userId of topUsers) {&lt;br&gt;
  pipeline.hgetall(&lt;code&gt;user:${userId}&lt;/code&gt;);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;const users = await pipeline.exec();**_&lt;/p&gt;

&lt;p&gt;Now:&lt;/p&gt;

&lt;p&gt;Only 1 network round trip&lt;/p&gt;

&lt;p&gt;All commands executed in batch&lt;/p&gt;

&lt;p&gt;No more N+1 latency&lt;/p&gt;

&lt;p&gt;This was the real breakthrough.&lt;/p&gt;

&lt;p&gt;The Results&lt;/p&gt;

&lt;p&gt;Here’s how it evolved:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stage Latency&lt;br&gt;
DB sorting  ~200ms&lt;br&gt;
Redis (no pipeline) ~120ms&lt;br&gt;
Redis + pipeline    ~20ms&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A full 10x improvement.&lt;/p&gt;

&lt;p&gt;And interestingly, the biggest win wasn’t just using Redis.&lt;/p&gt;

&lt;p&gt;It was reducing network round trips.&lt;/p&gt;

&lt;p&gt;What This Taught Me&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Infrastructure problems come first&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If Redis isn’t running cleanly, nothing else matters.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data structures matter&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;ZSET eliminated repeated sorting completely.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;N+1 problems aren’t just database issues&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;They can happen in any remote system.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Network latency is invisible — but expensive&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Even “fast” systems become slow when you talk to them too many times.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Docker simplifies backend life&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead of fighting your OS, containerize dependencies.&lt;/p&gt;

&lt;p&gt;Final Architecture&lt;/p&gt;

&lt;p&gt;Now the /leaderboard flow looks like this:&lt;/p&gt;

&lt;p&gt;Score update → ZADD&lt;/p&gt;

&lt;p&gt;Fetch top 10 → ZREVRANGE&lt;/p&gt;

&lt;p&gt;Batch fetch user data → pipeline + exec&lt;/p&gt;

&lt;p&gt;Return response&lt;/p&gt;

&lt;p&gt;No DB hit.&lt;br&gt;
Fully in-memory.&lt;br&gt;
Minimal network calls.&lt;br&gt;
~20ms response time.&lt;/p&gt;

&lt;p&gt;Clean.&lt;/p&gt;

&lt;p&gt;Closing Thought&lt;/p&gt;

&lt;p&gt;Optimization isn’t about throwing tools at a problem.&lt;/p&gt;

&lt;p&gt;It’s about identifying where time is actually being spent.&lt;/p&gt;

&lt;p&gt;For me, it wasn’t just the database.&lt;/p&gt;

&lt;p&gt;It was:&lt;/p&gt;

&lt;p&gt;The environment&lt;/p&gt;

&lt;p&gt;The data structure&lt;/p&gt;

&lt;p&gt;And the network&lt;/p&gt;

&lt;p&gt;And fixing those made all the difference.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>productivity</category>
      <category>database</category>
    </item>
  </channel>
</rss>
