DEV Community

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

Posted on • Edited on

Daily DSA and System Design Journal - 10

"Small daily progress leads to massive long-term impact."

After 10 days of deliberate consistency (with one comeback arc), I’m starting to see deeper intuition forming — both in coding logic and in understanding scalable systems.


🧩 DSA Problems [1 hr]

Problem: 3349. Adjacent Increasing Subarrays Detection I

This one was subtly challenging — the logic feels simple at first glance, but optimizing for a single traversal takes thought.


💡 Approach: One-Time Traversal

🧠 Intuition

If two adjacent strictly increasing subarrays of length k exist, they also exist for all lengths < k.
So the key is to find the largest valid k′ and check if it satisfies the condition.

We track two variables:

  • cnt: length of the current increasing subarray
  • precnt: length of the previous one

At every point:

  • If nums[i] > nums[i−1], increment cnt.
  • Else, the increasing streak resets — set precnt = cnt, cnt = 1.

Then compute:

  • min(precnt, cnt) → represents adjacent subarrays.
  • cnt // 2 → represents one long continuous increasing run.

💻 Code

class Solution:
    def hasIncreasingSubarrays(self, nums: List[int], k: int) -> bool:
        n = len(nums)
        cnt, precnt, ans = 1, 0, 0
        for i in range(1, n):
            if nums[i] > nums[i - 1]:
                cnt += 1
            else:
                precnt, cnt = cnt, 1
            ans = max(ans, min(precnt, cnt))
            ans = max(ans, cnt // 2)
        return ans >= k
Enter fullscreen mode Exit fullscreen mode

⚡ Takeaways

  • Built intuition around state tracking across traversals.
  • Reinforced understanding of adjacency logic and sequence continuity.
  • Learned to express a condition efficiently without nested loops.

🏗 System Design — Roadmap.sh [1 hr]

🎯 Topic: Background Jobs

Background jobs handle work that doesn’t need to block the main application flow. Think of them as quiet backstage workers keeping your system smooth.


🧠 Common Use Cases

Maintenance tasks: cleanups, report generation, backups
Heavy computation: ML training, analytics, or aggregation
Async communication: emails, notifications, webhooks
Batch data ops: imports/exports, ETL pipelines


⚙️ Implementation Patterns

  • Job Queue + Workers: Tasks get queued (e.g., RabbitMQ, SQS, Redis Queue), then processed by worker nodes.
  • Schedulers (e.g., Cron): Trigger recurring background tasks.
  • Retry + Monitoring: Failed jobs should retry intelligently with backoff and be observable (via dashboards/logs).

🧩 Real-World Examples

  • Gmail: sending emails asynchronously after user hits “Send”
  • Stripe: generating reports and invoices via background batch jobs
  • GitHub: background actions for CI/CD pipelines

💬 Reflection

The “background job” concept mirrors our own learning process:
the main thread is daily consistency, while the background jobs are reflection, documentation, and review — silently compounding over time.


✅ Key Takeaways

  • DSA sharpened my reasoning for adjacency-based problems.
  • System Design reinforced non-blocking execution and asynchronous scaling.
  • 10 Days in — this rhythm is starting to feel automatic.

🤝 Let’s Connect

10 days in — what’s your “background job” for personal growth?
Something that runs quietly every day, but changes you over time?

Drop a ⚙️ if you’ve got one.

Top comments (0)