Meta Interview Question

binary division with some twists, path finding