15,921,841 members
See more:
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
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..

## Solution 1

Try this wiki article[^] as a starting point

## Solution 2

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.

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.

Top Experts
Last 24hrsThis month
 Richard Deeming 50 Ștefan-Mihai MOGA 35 Wendelius 20 Dave Kreskowiak 18 George Swan 10
 Pete O'Hanlon 995 OriginalGriff 916 Dave Kreskowiak 493 Richard Deeming 340 Richard MacCutchan 320

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