Algo :
Traverse the string from first to end.If u trace one char,store it's position and when you face the next character calculate distance.Repeat this till you reach end of string.
http://shashank7s.blogspot.com/2011/03/wap-to-find-min-distance-between-two.html
Minimum distance between two numbers in an array : http://www.geeksforgeeks.org/archives/13128
Traverse the string from first to end.If u trace one char,store it's position and when you face the next character calculate distance.Repeat this till you reach end of string.
http://shashank7s.blogspot.com/2011/03/wap-to-find-min-distance-between-two.html
Minimum distance between two numbers in an array : http://www.geeksforgeeks.org/archives/13128
No comments:
Post a Comment