Company: Samsung_16nov
Difficulty: medium
Find Position in Monotone Sequence Problem Description A monotone increasing sequence is given below. The sequence index is an integer that starts with 1. The sequence is defined by the recurrence relation: f_k = a * f_[k/2] + b * floor(log2(k)) + c * k for k > 1 And the base case: f_1 = 1 Here, [k/2] means integer division (floor of k/2), and floor(log2(k)) means taking the logarithm to the base 2 and rounding the value down. When an integer X is given, the element's position (k) of the integer X in the sequence has to be determined. For instance, if for the above sequence, a=2, b=2, c=1, then the sequence will be f_k = 2 * f_[k/2] + 2 * floor(log2(k)) + 1 * k. If we enumerate the sequence, beginning with its first element, the enumeration will be 1, 14, 30, 49, and so on. For example, 12,187,000,000,000 is the 27th element of this sequence. However, 12,187,000,000,000 is not an element in the sequence. Given a, b, c and a positive integer X, write a program that finds out the positio