Please enter your email address or userHandle.
Given 2 integers N and K. Convert N(given in Decimal) to base K.
N = 10, K = 2
(10)10 = (1010)2
N = 4, K = 8
(4)10 = (4)8
You don't need to read input or print anything. Your task is to complete the function changeBase() which takes Integers N and K as input and returns an integer as the answer.
Expected Time Complexity: O(logKN)
Expected Auxiliary Space: O(logKN)
1 <= N <= 105
2 <= K <= 10
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.