There were two questions of different companies.
- A tree will be given, each node will have one candy and cost to collect that candy. Find out the maximum candies that can be collected across all nodes. Looks like dfs question to me.
- An array of integers is given. Find out the maximum value subarray formed by summing the elements of subarray and multiplying it by any element present in subarray. Brute force approach with some optimization can be done but is there any other method.
Can anyone provide with reference to similar question because i couldn't do it at that time.