Hey, Tell me if this assumption of the problem statement is correct..

String: ram

Matrix:
|r  | a  b
|a | g  h
|m|  j  d

This is vertical and similar for its horizontal counter part...

So the logic is more than obvious,
For vertical (and horizontal), do a sub-string search column-wise and
(row-wise for horizontal) wrt the string. Using KMP It'd be O(mn) for an MxN
matrix

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to