Company: Nasdaq_18oct
Difficulty: medium
Find Power Problem Description You are given two integers, max_val and a . Find the biggest integer b such that a^b <= max_val . Here a^b means a multiplied by itself b times, so a^0 = 1 , a^1 = a , a^2 = a * a , and so on. Because a^0 = 1 <= max_val always holds, the answer always exists and is at least 0 . Function Description Complete the function findPower in the editor. It has the following parameters: int max_val : the maximum authorized value int a : the value that will be raised to a power It returns an int : the biggest integer b such that a^b <= max_val . Input Format Read from standard input. The first line contains the integer max_val . The second line contains the integer a . Output Format Print a single integer: the biggest b such that a^b <= max_val . Constraints 1 <= max_val <= 2,000,000,000 2 <= a <= 2,000,000,000 Examples Example 1 Input: 33 2 Output: 5 Explanation: The powers of 2 are 1, 2, 4, 8, 16, 32, 64, ... . 2^5 = 32 <= 33 , but 2^6 =