You are viewing a single comment's thread. Return to all comments →
It was a while ago so I can't say for sure what my assumptions were. If I had to guess I would say I was under the assumption a solution must exist for the data supplied and thus my algorithm works correctly under that assumption. At least I think it does. Do you have an example where it doesn't?
Since no where it is asked to return -1 if solution does not exists, your assumption is correct. A solution must exists. Hence, we do not need to use a circular queue. :)