Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
User enters 3 or 4 digit number say - X.
I need a+b+c=X where,
a,b,c are 3 digit numbers and all digits are unique among all 9 digits. That is a,b,c does not have any repetitive digit on any position.

I need all possible combinations/solutions for 'X'. That is all possible a+b+c combinations.

Suggest me algorithm or logic for the same asap.
Posted
Comments
CHill60 29-Jan-15 6:23am    
Sounds like homework - is it?
forccyy 29-Jan-15 6:27am    
Noo.. Its a challenge in a competition.. where i can use google/internet..:)
Plz reply fast if you have any idea..

Try this wiki article[^] as a starting point
 
Share this answer
 
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

And by the way: demanding that people you want free help from should do things "asap" is not a good way to make friends - or get anything done for you at all.
 
Share this answer
 
Comments
forccyy 3-Feb-15 8:14am    
Thank u all for ur comments .. but it would be great if u guys would have helped me instead of comments. By the way I solved the problem and got results also before posting question but I wanted to improve performance that is why I asked question here. Currently I am using 3 loops which is taking 47 sec to return results. I Wanted to opt till 3 sec.

I wnated fresh and different algorithm thatz why I did not post my algo logic here.
OriginalGriff 3-Feb-15 8:29am    
All you gave us to work with was: "Suggest me algorithm or logic for the same asap."
That isn't the same as "I wanted to improve performance that is why I asked question here. Currently I am using 3 loops which is taking 47 sec to return results. I Wanted to opt till 3 sec.

I wnated fresh and different algorithm thatz why I did not post my algo logic here."

If you want specific help, then ask for specific help.
If you ask for us to do your homework, then you will always get the same reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900