Directi internship question

please tell me if it is a adhoc based question or we need to know certain things beforehand to solve it?

No special knowledge needed. Just a little use of logic will do
http://ideone.com/FMg1i4 Here is a link to my code…hope it helps

This my O(log(L)) solution. I used Divide and Conquer technique to solve this. http://ideone.com/jUDihh

1 Like