To find the bug the number of boxes between the box that u opened already and the box that the bug exists should be an odd number .
When ever u move to another box and then bug also moves to other box then the number of boxes between your box and rat box should add up to two or zero. The nature of number of boxes remains same (if odd it remains odd if even remains even)
So now start from 1 and go to 10 definitely there is a crossing point of u and bug. if not occurs then intially u and bug are differ by even number of boxes so when u reaches 10 open the box 10 again then now the nu