Description
Problem Statement You have to find the perfect number. Given that it is a positive , with no leading zeros and has exactly x digits in it. Suppose this integer is y if you move the last digit to the front then that integer will be z times of y. So, given integers, x and z find that perfect integer. The perfect integer should be minimum possible value. If an integer that meets this condition is not possible, return '-1'.
Constraints 1<=x<=3*10^4 1<=z<=9
Sample input 6 5
Sample output 142857
Please share your approach for this https://leetcode.com/discuss/interview-question/2108673/Finding-the-perfect-number
While soving u need to compute ((pow(10,x-1)-z))*(ld))/(10*z-1).... where ld->last digit
Now bcz x<=3e4 and no data type can store that big number u need to implement a function of long division method that takes in 2 strings as input,
u can traverse over last digit from (0 to 9 ) and see for which u can get a valid number y.the first valid number will be the smallest one ig.