You barely have to modify the algorithm. Just store the index of the most
recent occurrence instead of reporting it, then report whatever you have
stored right at the end.
On 2 April 2014 19:25, pawan yadav pawan1991ya...@gmail.com wrote:
Hi All,
How can we do the following problem in
Hi All,
How can we do the following problem in efficient way :
Implement lastindexofastring(String s1,String s2) . If s2 is present
multiple times return the last index of s2 in s1 , else return -1.
Is KMP applicable for this problem? If yes, then how can we modify KMP algo?
Thanks,
Pawan.
--