I am doing PS3 problem 1. I have written the code and it works fine. But the assignment says that the definitions should take 2 arguments (target and key). with the recursive code I had to include 2 extra arguments. Has anyone else done the same? Here's my code: Recursive Method: http://codepad.org/RXEaELgE Iterative Method: http://codepad.org/LZgvMDqm
I post my version of the answer a few days ago. You might want search it. In the meantime I'll have a look at yours
With the recursive function try the following: When you find an occurence of the searched for string (called substring) within a string you know the start position. When calling the function recursively do not send the entire string but just that part of the string ***one more*** than the position of the previous occurance. Hope this helps.
ok I'll have a look for your one. Thanks
Very elegant solution bwCA!!
Join our real-time social learning platform and learn together with your friends!