Myntra Interview Experience
Round 1:
- Given Parent Array Such that parent[i]=j where j is the parent and Value array . Need to Find Best possible sum .
Root node will have -1 as parent.
Best Possible sum is maximum sum in one of the tree paths.
Integer[] parent = new Integer[] { -1, 0, 0, 2, 3 }; Integer[] values = new Integer[] { 0, 4, 6, -11, 3 }; (0/0)----(1/4) | | (2/6) | | (3/-11) | | (4/3)
Maximum sum here would be 6+0+4=10 for path 2-->0-->1. - Degree of An Array.
https://leetcode.com/articles/degree-of-an-array/ - Monsoon umbrellas.