Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
1,0
1,9
1,3
9,0
9,1
9,3
9,5
3,0
3,9
5,0

Explanation : digit before comma(,) can go to digit after comma.
That is, 1 can go to 0,9, and 3.
3 can go to 0,9 and so on.
The main motive of this challenge is to move from one digit to another in shortest possible moves.

Input : 1,5
Output : 3
1-->9-->5
Posted
Updated 28-May-14 1:58am
v4
Comments
KaushalJB 28-May-14 8:02am    
What have u tried so far in code ?
Naz_Firdouse 28-May-14 8:03am    
try yourself and if you are struck ,share your you have tried so that others can help you
Member 10397973 28-May-14 8:06am    
Which logic to apply here?
I am not getting anything as of now.
Dave Kreskowiak 28-May-14 8:37am    
It's only URGENT to you, not to anyone answering your question. In fact, saying that it's so urgent will more likely get you ignored.
Member 10397973 28-May-14 8:48am    
I know...but i am not getting where to start from.
I haven't solved problems of these kind.
Can it be solved using arrays?

1 solution

This resembles the well known "traveling salesman problem"[^]. If your actual input is going to be so short then even a 'brute-force-attack' is suitable.
 
Share this answer
 

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