dreamkiller's blog

By dreamkiller, history, 2 years ago, In English

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

  • Vote: I like it
  • -20
  • Vote: I do not like it

| Write comment?
»
2 years ago, # |
  Vote: I like it +3 Vote: I do not like it
Hint1
Hint2
Hint3