Question bank › Dynamic Programming
Dsa Dynamic Programming Easy

Router Optimization

A network consists of `n` routers connected linearly, with a given latency between each pair of adjacent routers. You can improve the connection speed by installing optimizers on any one router. Your task is to determine the minimum total latency after potentially improving one connection. Input format: The first line contains an integer n (1 <= n <= 1000) - the number of routers. The second line contains `n-1` integers representing the latency between each pair of routers. Output format: Print the minimum total latency after optimizing one router. Example: Input: 4 10 5 20 Output: 25

Key concepts

dynamic_programmingnetworkpaths

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.