🚀 Day 8: 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 8 — kicking off a brand new week! 💡
🏗 System Design: Replication
Today’s concept was Replication — an availability pattern where multiple copies of data are stored across locations to improve resilience and scalability.
There are two main types:
🧭 Master-Slave Replication
- Master handles all writes (and sometimes reads).
- Slaves handle reads only, reducing load on the master.
- If the master fails, a slave can be promoted.
- Often used to scale read-heavy workloads.
⚠️ Disadvantages:
- Slave promotion adds complexity.
- Replication lag can cause stale reads.
- Heavy write loads can overwhelm replicas.
🔁 Master-Master Replication
- Multiple masters handle both reads and writes.
- Higher availability since any node can serve as fallback.
- Useful when you need multi-region writes.
⚠️ Disadvantages:
- Requires conflict resolution (e.g., two writes at once).
- Can hurt performance due to synchronization overhead.
- Often trades off consistency for availability.
💭 My Thoughts: Replication is one of those things that sounds simple (“just copy the data”), but the edge cases and trade-offs—lag, conflicts, and complexity—make it a real engineering challenge.
💻 DSA Challenge: 3Sum
Today’s LeetCode challenge was 15. 3Sum.
⏳ Time spent: ~1+ hours (with the help of this YouTube walkthrough).
👨💻 Code Snippet
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
res = []
nums.sort()
for i in range(len(nums)):
if i > 0 and nums[i] == nums[i-1]:
continue
j, k = i + 1, len(nums) - 1
while j < k:
total = nums[i] + nums[j] + nums[k]
if total > 0:
k -= 1
elif total < 0:
j += 1
else:
res.append([nums[i], nums[j], nums[k]])
j += 1
while j < k and nums[j] == nums[j-1]:
j += 1
return res
✨ Key Takeaways
- Sorting + two-pointer technique = super efficient here.
- Avoids brute-force O(n³) by reducing it to O(n²).
- Learned how to skip duplicates to keep results clean.
🙌 Final Thoughts
Day 8 gave me a powerful reminder:
- On the System Design side, replication is about balancing availability vs complexity.
- On the DSA side, smart strategies like sorting + two pointers can completely transform performance.
I’m excited to keep this momentum rolling into the new week 🚀.
🤝 Let’s Connect!
💡 This is Day 8 — the start of Week 2!
I’d love to hear from you:
- Have you worked with replication setups (master-slave or master-master)? Which challenges stood out?
- Any alternative approaches you’ve used for the 3Sum problem?
- Or just drop a 🔁 in the comments if you’ve ever had to replicate systems (or solve 3Sum 😉).
Your feedback, experiences, and encouragement push me to keep showing up daily — let’s make this journey even more interactive 🙏.
Top comments (0)