Question bank › Trees
Dsa Trees Medium

The Branching Irrigation System

An irrigation system is a tree of pipes. Water flows from the root. At each node, the incoming water is divided EQUALLY among its children. Every edge (pipe) has a maximum capacity. If the water assigned to a pipe exceeds its capacity, the pipe bursts. Find the maximum amount of water (float) you can pump into the root without bursting any pipe in the entire system. Input Format: Line 1: N (number of nodes) Next N-1 lines: u v C (parent u, child v, capacity C) Example: Input: 3 0 1 10 0 2 10 Output: 20.0000

Key concepts

tree constraintsbottom-up optimizationmath

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.