Get Minimum Servers

Problem Overview

  • Compute the minimum number of leaf removals so no server u has a descendant v where path activity from u to v exceeds minActivity[v].
  • Input: a rooted tree (root 1) with server_nodes, edges (server_from, server_to) with server_weight, and minActivity; Output: an integer.
  • Path activity is the sum of edge weights; signals start at 0; values may be negative.
  • Constraints: up to 2e5 nodes; weights and thresholds in [-1e9, 1e9].
  • Real-world: servers capturing neural signals in ML; a Cisco interviews coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: