Virtusa neural hack 2020
Anonymous User
5993

**I recently got this question in coding coontest i was not able to solve can you please help me out.

ques:-in a tv show game of thrones there are n houses on a battle field and n-1 bidirectional roads connecting houses
it is knwn that you can reach any house from anywhere each house has its own army.
A battle is fought between two armys(houses) who have a path between their houses one army can take part in one
episode of the show the winning and loosing teams can still fight but on the next day.
you are the friend of the directors help him to find the minimum episodes he need to air this season and also the
number of battles fought on the kth episode . in case of multiple outcomes return output which the maximum number
of fights take plac after.

input1 = n
input2 = k
input3 = 2d a[0][i] path to a[1][i]

Sample Tc:
n = 4
arr = [[1,1,1],[2,3,4]]
k = 2

output=(3,1){3-episodes,1-battle on 2 nd day}
in each episode 1 battle {1,2} {1,3} and {1,4}
on second day 1 battle.

Sample Tc:
n = 4
arr = [[1,1,4],[4,2,3]]
k = 2

output=(2,2)

on first day {1,4} on second day {4,3}and{1,2} hence minimum episodes is 3
and on second day 2 battles.

**

Comments (3)