Salesforce Interview Experience | MTS | 4.5 yrs
Anonymous User
715

Online Assesment:

Q1 A number of bids are receieved for a project. Determine the number of distinct pairs of project costs where their absolute difference is some target value. Two pairs are distinct if they differ an at least one value.

Eg n=3, projectCosts = [1,3,5], target = 2
Output = 2

There are 2 pairs [1,3][3,5] with target difference 2. Therefore 2 is returned.

Eg n = 5, projectCosts = [1,5, 3, 4, 2], target = 2
Output = 3

Q2 You have n chocolates with weights given in an array weights[n], where weights[i] represents the weight of the ith chocolate. Each day. you can pick one chocolate, consume half of its weight (calculated as floor(weight[i]/2)), keeps the remaining portion. Calculate the minimum possible total weight of the chocolate after d days. Note that you can eat from the same chocolate multiple times.

Eg. weights = [2,3], d = 1;
Output = 4

Round 1

Q1: Maximum path sum in a tree.

Q2: Print the path of the maximum path sum.

Verdict: Rejected

Comments (3)