DEV Community

Cover image for Daily DSA and System Design Journal - 7
I.K
I.K

Posted on

Daily DSA and System Design Journal - 7

๐Ÿš€ Day 7: System Design + DSA Journey

Hello! Iโ€™m continuing my journey of daily learning, focusing on System Design concepts (via the roadmap.sh System Design Roadmap) and then tackling DSA challenges on LeetCode. This is DAY 7 โ€” one full week complete! ๐ŸŽ‰


๐Ÿ— System Design: Failover

Todayโ€™s concept was Failover โ€” an availability pattern that ensures a system can continue to function if a component fails.

At its core:

  • The primary component handles requests.
  • The secondary/backup component stays on standby.
  • If the primary fails, the backup kicks in โ€” keeping the system alive with minimal disruption.

๐Ÿ”„ Types of Failover

๐Ÿ’ค Active-Passive (Master-Slave)

  • Primary handles all traffic.
  • Backup sits idle, monitoring via heartbeats.
  • If the primary fails โ†’ backup takes over.
  • Can be hot standby (already running) or cold standby (needs startup).

โšก Active-Active (Master-Master)

  • Both servers handle traffic concurrently.
  • Load is shared between them.
  • Public-facing: DNS must know about both IPs.
  • Internal-facing: application logic must route to both.

โš ๏ธ Challenges with Failover

  • Extra hardware + complexity.
  • Risk of data loss if primary fails before replication completes.

๐Ÿ’ญ My Thoughts: Failover reminds me that resilience is never โ€œfree.โ€ You gain uptime, but at the cost of added complexity, infra, and edge-case handling. Still, for critical systems, itโ€™s worth it.


๐Ÿ’ป DSA Challenge: Longest Common Prefix

Todayโ€™s DSA problem was 14. Longest Common Prefix.

โณ Time spent: ~1 hour.
I started with a fixed-prefix-length approach (which worked but wasnโ€™t optimal). After exploring more solutions, I found this sorted strings approach to be elegant and efficient.


๐Ÿ‘จโ€๐Ÿ’ป Code Snippet

class Solution:
    def longestCommonPrefix(self, v: List[str]) -> str:
        ans = ""
        v = sorted(v)
        first, last = v[0], v[-1]

        for i in range(min(len(first), len(last))):
            if first[i] != last[i]:
                return ans
            ans += first[i]
        return ans
Enter fullscreen mode Exit fullscreen mode

โœจ Key Takeaways

  • Sorting reduces the problem to comparing just the first and last strings.
  • Clean, efficient, and avoids unnecessary checks.
  • Sometimes a different perspective on the problem (like sorting) gives a more elegant solution than brute-force approaches.

๐Ÿ™Œ Final Thoughts

Day 7 wraps up my first full week of this journey.

  • On the System Design side, Failover showed me how high availability is engineered through redundancy and switchover strategies.
  • On the DSA side, I learned that simplicity often emerges from smart problem framing (like sorting).

One week in, and I already feel sharper at identifying trade-offs and structuring solutions. ๐Ÿ’ช


๐Ÿค Letโ€™s Connect!

๐ŸŽ‰ 7 days straight โ€” the first milestone achieved!

But hereโ€™s where Iโ€™d love your help:

  • Whatโ€™s your experience with failover setups โ€” active-passive vs active-active?
  • Do you prefer clever solutions like sorting for prefix problems, or do you stick with more direct approaches?
  • Or just drop a ๐ŸŽฏ in the comments to celebrate 1 full week!

Your engagement (likes, shares, comments) not only motivates me but also helps more learners see this journey. Letโ€™s keep building together ๐Ÿš€.

Top comments (0)