🚀 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
✨ 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)