You are given 2 numbers (n , m); the task is to find n√m (nth root of m).
Input: n = 2, m = 9
Explanation: 32 = 9
Input: n = 3, m = 9
Explanation: 3rd root of 9 is not
You don't need to read or print anyhting. Your task is to complete the function NthRoot() which takes n and m as input parameter and returns the nth root of m. If the root is not integer then returns -1.
Expected Time Complexity: O(n* log(m)) Expected Space Complexity: O(1)