Can you reach target with distance-threshold edges? | Google Interview Question