The N-th root of an integer
Problem
You are given two positive integers N and M. You have to find the Nth root of M i.e. M^(1/N)
Solution Approach
Divide and Conquer.
Expected Time complexity:
Click - to see solution code
- C++
#include <bits/stdc++.h>
double findNthRootOfM(int n, long long m) {
return pow(m, (1.0 / n));
}