Company: amazon_23april
Difficulty: medium
Code Question 2 Data analysts at Amazon are analyzing time-series data. It was concluded that the data of the n th item was dependent on the data of some x th day if there is a positive integer k such that floor(n/k) = x, where floor(z) represents the largest integer less than or equal to z. Given n, find the sum of all the days' numbers on which the data of the x th (0 ≤ x ≤ n) will be dependent. Function Description Complete the function getDataDependenceSum in the editor below. getDataDependenceSum takes the following arguments: long int n : the day to analyze the data dependency for Returns long int : the sum of days on which the data is dependent Constraints 1 ≤ n ≤ 10 10 Example Suppose n = 5 x k floor(n/k) 0 6 floor(5/6) = 0 1 5 floor(5/5) = 1 2 2 floor(5/2) = 2 3 Does not exist - 4 Does not exist - 5 1 floor(5/1) = 5 Hence the answer is 0 + 1 + 2 + 5 = 8. Sample Case 0 Input: 13 Output: 29 The data of the n = 13 th day is dependent on [0, 1, 2, 3, 4, 6, 13] obtained for k = [14