Kth Root(challenges)

pl give me hint for the logic to solve this problem

@deepanshu_123,

You are given n and k.
Find the greatest integer x, such that, x^k <= n
Sample Input:
2
10000 1
1000000000000000 10
first case:
Here n = 10000 and k = 1;
Find x such that x^(1) <= 10000

second case:
Here n= 1000000000000000 and k = 10;
Find x such that x^(10) <=1000000000000000

Suggested approach:

We will aplly binary search in this problem. For every possible mid obtained by using binary search we will check of it is the best suitable candidate or not for becoming the Kth root and then we reduce the search space of the binary search according to the mid value. If mid^k is greater than N then we will find the best suitable value from left to mid-1 otherwise we will find much larger value by finding it from mid+1 to right.