Friday, July 17, 2009

Sudoku Solver.

My next target would be a program which accepts a Su-doku matrix as input and fills up the whole matrix with correct values.

This thought just came to my mind. So, this can take some time. Dont ask me how long ;)

Planning to implement this in Cpp.

Give it a try yourself as well.
Donot try to find algorithm from internet and blindly implement it. Thats no big deal. Try to think an algorithm yourself.

Come on lets do it!!!!!!!

1 Digit for 1 Character puzzle.

Here is a problem I tried to solve using Java. Its been 3 long years that I seriously coded in Java. So, language experts please pardon any java related issues it may have. Any suggestions to improve the performance of the program are welcome. I will try and improve the program from my side as well.

The puzzle definitions goes like this:-

Accept three character strings string1, string2 and string3.
Our problem is to assign a unique digit to each of the characters of strings 1,2 and 3 uniquely such that the numbers ultimately formed by String1 and String2 add up to String3.

Conditions:-

1). List out all the possible combinations for the characters which satisfy the condition of adding.
2). Make sure that the first character of each of the strings are not assigned a zero '0'.
3). If there no are solutions possible for a given three strings, the program should give an appropriate error message.

Try your programming and analytical skills on this program. Try and make the code as efficient as possible.
Happy coding....

Sample Runs:-

e.g:-

Input:-
String1 :- SEND String2 :- MORE String3 :- MONEY

Output:-
-------Combination Number: 1-------
SEND+MORE=MONEY
9567+1085=10652
--------------------------------------

Input:-
String1 :- NO String2 :- MORE String3 :- MONEY

Output:
------------------------------------
No combinations for :-
NO+MORE=MONEY
--------------------------------------

Request you guys to give it a try first.

The program can be found at:
Click here