题目描述
Given 2 integers N and K. Convert N(given in Decimal) to base K.
Example 1:
Input:
N = 10, K = 2
Output:
1010
Explanation:
(10){10} = (1010)
Example 2:
Input:
N = 4, K = 8
Output:
4
Explanation:
(4){10} = (4)
Your Task:
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(log_{K}N)
Expected Auxiliary Space: O(log_{K}N)
Constraints:
1 <= N <= 10^{5}
2 <= K <= 10
输入格式
见题面
输出格式
见题面
样例输入
N = 10, K = 2
样例输出
1010