Minimum Tax in Journey

Company: Cargill_5oct

Difficulty: medium

Problem Statement

Minimum Tax in Journey Problem Description A city has n toll plazas, numbered from 0 to n - 1 . The plazas are joined by roads so that they form an undirected tree. The roads are given in the 2D integer array paths , where paths[i] = [a, b] means there is a road between plazas a and b . Each toll plaza charges a tax. You are given the integer array tax , where tax[i] is the tax required to cross plaza i . The total tax of a route is the sum of the taxes of all plazas on it, including the plaza where the journey starts and the plaza where it ends. You are also given the 2D integer array journeys , where journeys[i] = [start, end] describes the i-th journey. It goes from plaza start to plaza end along the unique route between them in the tree. Before every journey, you may choose some toll plazas and halve their taxes for that journey. No two chosen plazas may be joined directly by a road. The choice is made again, from the original taxes, before each journey. (inferred -- the source say