Leaderboard
Showing:
Seeds of a number
Easy Accuracy: 33.33% Submissions: 27 Points: 2

A Seed of a number n is a number x such that multiplication of x with its digits is equal to n. The task is to find all seeds of a given number n. x should not be equal to n. If no seed exists, then print -1.

Example 1:

Input: n = 138
Output: 23
Explaination: 23 is a seed of 138 because 
23*2*3 = 138.

Example 2:

Input: n = 3
Output: -1
Explaination: There is no seed of 3.

Your Task:
You do not need to read input or print anything. Your task is to complete the function seeds() which takes n as input parameter and returns the seeds of the number.

Expected Time Complexity: O(n)
Expected Auxiliary Space: O(1)

Constraints:
1 ≤ n ≤ 1000

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Seeds of a number

Output Window