InterviewStack.io LogoInterviewStack.io

Algorithmic Complexity & Code-Level Optimization Questions

Reasoning about the time and space complexity of code and applying local optimizations that materially change performance. Covers Big-O analysis and performance modeling, data-structure selection, hot-loop and allocation reduction, and knowing when an algorithmic change beats micro-optimization. Emphasizes performance-aware coding grounded in complexity rather than premature tuning.

MediumTechnical
75 practiced

You run a background job system with tasks that are either CPU-bound or I/O-bound. Describe how you would decide concurrency levels for each type, which metrics to monitor (CPU utilization, queue length, I/O wait, latency), and how you would implement autoscaling or adaptive concurrency to maximize throughput while meeting latency SLOs.

HardTechnical
77 practiced

Develop a probabilistic model to estimate p99 and p99.9 tail latency for a service that has two classes of requests: normal (99.5%) with latency distribution approximated by Exp(50ms) and slow (0.5%) with distribution Exp(500ms) due to GC or external calls. Compute approximate p99 and p99.9 latencies and discuss mitigation techniques such as hedged/replicated requests, adaptive timeouts, and admission control.

HardSystem Design
96 practiced

Design a globally distributed cache layer for read-heavy product metadata that must serve the 95th percentile of reads within 50ms globally, support 100k QPS, and provide eventual consistency within 10 seconds. Sketch components (origin DB, regional caches, CDN, invalidation), replication and warming strategies, and failure modes (regional outage, stale reads).

HardTechnical
108 practiced

An on-call alert reports p99 latency for your API doubled during a deployment window. Provide a step-by-step incident response checklist as an SRE: immediate triage actions, dashboards and metrics to inspect (latency by route, error rates, CPU/GPU/GC/thread metrics), quick mitigations to reduce user impact, communication templates, and key items for the post-incident review.

MediumSystem Design
75 practiced

Compare blue-green, canary, and rolling deployments for a performance-sensitive backend. For each strategy describe how to set up performance gating (metrics, thresholds, statistical tests), automate gradual rollout and rollback, and what monitoring and alerting you would use to protect SLOs during deployment.

Unlock Full Question Bank

Get access to all Algorithmic Complexity & Code-Level Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.