Error
|
|
---|---|
@Ibrahim Nash | 5761 |
@blackshadows | 5701 |
@akhayrutdinov | 5111 |
@mb1973 | 4989 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 938 |
@bt8816103042 | 739 |
@SHOAIBVIJAPURE | 428 |
@codeantik | 412 |
@SherlockHolmes3 | 407 |
@neverevergiveup | 348 |
@mahlawatep | 347 |
@shalinibhataniya1097 | 343 |
@murarry3625 | 333 |
@saiujwal13083 | 326 |
@rohitanand | 314 |
Complete Leaderboard |
Given a number X and another number Y . There are a total N cycles , and alternatively we perform operation on each number . In each cycle , we multiply the number by 2 . Starting with X .
Suppose after all the N cycles, the number X has become W and number Y has become Z . Find the integer division of the maximum number among W and Z by the minimum number among W and Z .
Example 1:
Input: x = 1, y = 2, n = 1
Output: 2
Explanation: the initial numbers are (X = 1,
Y = 2). There is only one turn. In this turn X
is multiplied by 2. Hence, we get (X = 2,
Y = 2)
Therefore W = 2, and Z = 2.
max (W , Z) / min (W , Z) = 2 / 2 = 1.
Hence the first output is 1.
Example 2:
Input: x = 3, y = 2, n = 3 Output: 3 Explanation: the initial numbers are (X = 3, Y = 2). There three turns. In the first cycle X is multiplied by 2.So, we get (X = 6, Y = 2). In the second cycle Y (Y = 2) multiplies his number by 2. Hence, we get ( X = 6, Y = 4 ). In the third cycle X ( X = 6) is multiplied by 2. So, we get (X = 12, Y = 4) . As N = 3 , completed with 3 cyles, therefore W = 12 and Z = 4. max (W , Z) / min (W , Z) = 12 / 4 = 3. Hence the second output is 3.
Your Task:
You don't need to read or print anyhting. Your task is to complete the function find_division() which takes X, Y and N as input parameter and returns the integer division of max(w, z) / min(w, z)
Expected Time Complexity: O(1)
Expected Space Complexity: O(1)
Constraints:
1 <= X, Y <= 108
1 <= N <= 109
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes