<?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: Aaysha</title>
    <description>The latest articles on DEV Community by Aaysha (@spiderbird).</description>
    <link>https://dev.to/spiderbird</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%2F1270004%2Fc02e5025-5976-4ef4-a0d0-c3fd56d1c34f.png</url>
      <title>DEV Community: Aaysha</title>
      <link>https://dev.to/spiderbird</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/spiderbird"/>
    <language>en</language>
    <item>
      <title>Merge 2 Sorted LinkedLists!</title>
      <dc:creator>Aaysha</dc:creator>
      <pubDate>Fri, 25 Jul 2025 20:36:28 +0000</pubDate>
      <link>https://dev.to/spiderbird/merge-2-sorted-linkedlists-2414</link>
      <guid>https://dev.to/spiderbird/merge-2-sorted-linkedlists-2414</guid>
      <description>&lt;p&gt;Hey fellow devs! 👋&lt;br&gt;
Today I was doing a revision of linkedList basics and encountered this leetcode problem. I actually forgot how to do it and had to solve it again and found the problem quite satisfying with a simple elegant solution. I thought I would share it here&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The problem is &lt;a href="https://leetcode.com/problems/merge-two-sorted-lists/submissions/570584148/" rel="noopener noreferrer"&gt;Merge Two Sorted LinkedLists&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You are given the heads of two sorted linked lists list1 and list2.&lt;/p&gt;

&lt;p&gt;Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists.&lt;/p&gt;

&lt;p&gt;Return the head of the merged linked list.&lt;br&gt;
So I started thinking — “Hey, this is basically merging two sorted arrays, right?” So I just tried to replicate that logic but with linked lists.&lt;/p&gt;

&lt;p&gt;And boom 💥 — it worked.&lt;/p&gt;

&lt;p&gt;Here's the version I first wrote:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution:
    def mergeTwoLists(self, l1: ListNode, l2: ListNode) -&amp;gt; ListNode:
        if l1 is None: return l2
        if l2 is None: return l1

        i, j = l1, l2
        head, k = None, None

        while i and j:
            if i.val &amp;lt;= j.val:
                newNode = ListNode(i.val)
                i = i.next
            else:
                newNode = ListNode(j.val)
                j = j.next

            if head is None:
                head = newNode
                k = head
            else:
                k.next = newNode
                k = k.next

        while i:
            k.next = ListNode(i.val)
            k = k.next
            i = i.next
        while j:
            k.next = ListNode(j.val)
            k = k.next
            j = j.next

        return head
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This version creates a new list by copying values — clean and readable. But then something hit me...&lt;/p&gt;

&lt;p&gt;Wait — in most linked list problems, they care about actual node identity too. What if they checked if I used the same node instances from the input lists?&lt;/p&gt;

&lt;p&gt;So I sat with it for sometime then realised the issue is with head initialization. Then it hit me what if I just initialize a dummy head and just reference the original nodes instead of duplicating them. Then while returning just return the next node to the dummy next. That led to this version:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;A cleaner, simpler approach:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution:
    def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -&amp;gt; Optional[ListNode]:
        if not list1:
            return list2
        if not list2:
            return list1

        i, j = list1, list2
        head = ListNode(0)
        res = head

        while i and j:
            if i.val &amp;lt;= j.val:
                res.next = i
                i = i.next
            else:
                res.next = j
                j = j.next
            res = res.next

        res.next = i if i else j
        return head.next
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This version feels a lot more elegant — fewer allocations, reuses existing nodes, and it’s just simpler to reason about. Just adding a dummy head node made the solution much easier and robust.&lt;/p&gt;

&lt;p&gt;Sometimes, taking a step back and asking “how can I improve this?” leads to those little "aha!" moments that make problem-solving so satisfying. And next time I face a similar problem, I’ll definitely think of this approach — not because I saw it in a video, but because I discovered it myself by playing around.&lt;/p&gt;

&lt;p&gt;Have you had any moments like this — where something just clicks while you’re coding or debugging? Would love to hear your stories!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day 1(long after day 0 )</title>
      <dc:creator>Aaysha</dc:creator>
      <pubDate>Tue, 22 Jul 2025 18:52:38 +0000</pubDate>
      <link>https://dev.to/spiderbird/day-1long-after-day-0--5goh</link>
      <guid>https://dev.to/spiderbird/day-1long-after-day-0--5goh</guid>
      <description>&lt;p&gt;Hey fellow devs! 👋&lt;br&gt;
I dipped after bragging about becoming a 10x engineer and making a public announcement of how I will be consistent(embarrassing!!). Well I am back and ready to give this another hand. The roadmap for the last post was created with the help of my mentor, Senpai chatGPT. From this post onwards, I have decided I will freestyle the content while trying to stick to Senpai's advice. I got laid off too (out of the blue), So I am struggling to decide whether I should practice DSA and system Design or focus on building fundamentals( Any advice is welcome).&lt;/p&gt;

&lt;p&gt;I built a &lt;strong&gt;CRUD API&lt;/strong&gt; server in the mean time as part of a company interview assessment. And learnt some DSA topics solved some leetcode questions. Today to break the long winter of my disappearance I will warm-up with solving a leet-code problem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/koko-eating-bananas/description/" rel="noopener noreferrer"&gt;Leetcode 875. Koko Eating Bananas&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem statement&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Koko loves to eat bananas. There are &lt;strong&gt;n&lt;/strong&gt; piles of bananas, the &lt;strong&gt;ith&lt;/strong&gt; pile has &lt;strong&gt;piles[i]&lt;/strong&gt; bananas. The guards have gone and will come back in h hours.&lt;/p&gt;

&lt;p&gt;Koko can decide her bananas-per-hour eating speed of &lt;strong&gt;k&lt;/strong&gt;. Each hour, she chooses some pile of bananas and eats &lt;strong&gt;k&lt;/strong&gt; bananas from that pile. If the pile has less than &lt;strong&gt;k&lt;/strong&gt; bananas, she eats all of them instead and will not eat any more bananas during this hour.&lt;/p&gt;

&lt;p&gt;Koko likes to eat slowly but still wants to finish eating all the bananas before the guards return.&lt;/p&gt;

&lt;p&gt;Return the minimum integer &lt;strong&gt;k&lt;/strong&gt; such that she can eat all the bananas within &lt;strong&gt;h&lt;/strong&gt; hours.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;br&gt;
Input: piles = [3,6,7,11], h = 8&lt;br&gt;
Output: 4&lt;/p&gt;

&lt;p&gt;Example 2:&lt;br&gt;
Input: piles = [30,11,23,4,20], h = 5&lt;br&gt;
Output: 30&lt;/p&gt;

&lt;p&gt;Example 3:&lt;br&gt;
Input: piles = [30,11,23,4,20], h = 6&lt;br&gt;
Output: 23&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1 &amp;lt;= piles.length &amp;lt;= 10^4&lt;br&gt;
piles.length &amp;lt;= h &amp;lt;= 10^9&lt;br&gt;
1 &amp;lt;= piles[i] &amp;lt;= 10^9&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thought process&lt;/strong&gt;&lt;br&gt;
So what is upper limit of rate &lt;strong&gt;k&lt;/strong&gt; at which koko can eat bananas? it will be the max of array(max of pile) if she ate at that rate she can always finish before h hours(because piles.length&amp;lt;=h). But koko would love to eat as slow as possible which is 1 banana per hour. So our desired k lies within the range (1,max(piles)). How to calculate how much time it will take koko to finish eating all the piles: Iterate through each pile, divide by k and round to the next integer if not completely divisible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def timeRequired(m):
 t=0
 for i in piles:
    t+=math.ceil(i/k)
 return t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this should be calculated for each k in range(1,max(piles)) then the time complexity become &lt;strong&gt;O(n*maxK)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;maxK=max(piles)
for k in range(1,maxK):
 t=timeRequired(k)
 if t==h:
   return k
 if t&amp;gt;h:
   return k-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Optimization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since we're searching for the smallest k in the range [1, max(piles)] such that Koko finishes eating all bananas within h hours, and the total time needed decreases as k increases, we can use binary search.&lt;/p&gt;

&lt;p&gt;We define:&lt;/p&gt;

&lt;p&gt;left = 1: slowest possible speed&lt;/p&gt;

&lt;p&gt;right = max(piles): fastest needed (eat whole pile in one hour)&lt;/p&gt;

&lt;p&gt;At each step, we:&lt;/p&gt;

&lt;p&gt;**1. Pick mid = (left + right) // 2 as our current candidate eating speed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Calculate time t = sum(ceil(pile / mid) for pile in piles).&lt;/li&gt;
&lt;li&gt;If time t&amp;lt;= h, it means mid is fast enough, but we want the minimum such speed → try smaller → right = mid.&lt;/li&gt;
&lt;li&gt;If total time t &amp;gt; h, it means mid is too slow → try faster → left = mid + 1.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We repeat this until left == right. At that point, left holds the minimum eating speed k that allows Koko to finish in time.**&lt;/p&gt;

&lt;p&gt;The improved time complexity is &lt;strong&gt;O(n*log(maxK))&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;l, r := 1, maxK
for l &amp;lt; r {
    m := (l + r) / 2
    if timeRequired(m) &amp;lt;= h {
        r = m
    } else {
        l = m + 1
    }
}
return l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>My Journey to Becoming a 10x Developer: Day 0</title>
      <dc:creator>Aaysha</dc:creator>
      <pubDate>Tue, 22 Apr 2025 19:22:49 +0000</pubDate>
      <link>https://dev.to/spiderbird/my-journey-to-becoming-a-10x-developer-day-0-4jo5</link>
      <guid>https://dev.to/spiderbird/my-journey-to-becoming-a-10x-developer-day-0-4jo5</guid>
      <description>&lt;p&gt;Hey fellow devs! 👋&lt;/p&gt;

&lt;p&gt;I'm a software engineer looking to level up my skills and share my learning journey. After reading some great advice on becoming a more impactful developer, I've decided to document my progress daily here on dev.to to stay accountable and hopefully help others along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Plan
&lt;/h2&gt;

&lt;p&gt;I'm focusing on building fundamentals and solving practical problems that showcase multiple skills at once. Here's what I'll be working on:&lt;/p&gt;

&lt;h3&gt;
  
  
  Core Projects
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Implement a Trie in Go&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;While relatively straightforward, tries are versatile data structures used in autocomplete, spell-checkers, and IP routing&lt;/li&gt;
&lt;li&gt;Will help me practice Go and efficient memory usage&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Design and Build a URL Shortener Service&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complete with a REST API, database persistence, and basic analytics&lt;/li&gt;
&lt;li&gt;Will cover web development, database design, and system architecture&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Implementing Advanced Data Structures&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;B-trees for database indexing&lt;/li&gt;
&lt;li&gt;Concurrent hash maps with lock striping&lt;/li&gt;
&lt;li&gt;Bloom filters for efficient set membership testing&lt;/li&gt;
&lt;li&gt;Skip lists for fast search within ordered data&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Distributed Systems Mini-Projects&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build a simple distributed key-value store with consistency guarantees&lt;/li&gt;
&lt;li&gt;Implement a leader election algorithm (Raft consensus)&lt;/li&gt;
&lt;li&gt;Create a basic load balancer with different strategies&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Performance Engineering&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Benchmark different data structures and algorithms&lt;/li&gt;
&lt;li&gt;Profile and optimize Go code using pprof&lt;/li&gt;
&lt;li&gt;Implement various concurrency patterns (worker pools, fan-out/fan-in)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Full-Stack Application&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build a real-time collaborative editor using WebSockets&lt;/li&gt;
&lt;li&gt;Implement JWT authentication and authorization&lt;/li&gt;
&lt;li&gt;Deploy using Docker and Kubernetes&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why This Approach?
&lt;/h2&gt;

&lt;p&gt;I believe becoming a "10x developer" isn't about typing faster—it's about making better decisions, understanding fundamentals deeply, and building systems that scale. These projects cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data structures and algorithms&lt;/li&gt;
&lt;li&gt;System design and architecture&lt;/li&gt;
&lt;li&gt;Performance optimization&lt;/li&gt;
&lt;li&gt;Testing and reliability&lt;/li&gt;
&lt;li&gt;DevOps and deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How I'll Track Progress
&lt;/h2&gt;

&lt;p&gt;For each project, I'll:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Post daily updates with code snippets and learnings&lt;/li&gt;
&lt;li&gt;Share benchmarks and performance metrics&lt;/li&gt;
&lt;li&gt;Discuss design decisions and trade-offs&lt;/li&gt;
&lt;li&gt;Include diagrams for system architecture&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;I'd love to hear your thoughts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are there other projects you'd recommend for becoming a more effective developer?&lt;/li&gt;
&lt;li&gt;Have you implemented any of these data structures or systems in Go?&lt;/li&gt;
&lt;li&gt;Any particular resources you've found helpful for advanced Go development?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow along as I document this journey, and let's learn together!&lt;/p&gt;

&lt;p&gt;#programming #datastructures #systemdesign #learneveryday&lt;/p&gt;

</description>
      <category>go</category>
      <category>webdev</category>
      <category>designpatterns</category>
    </item>
  </channel>
</rss>
