Compute shortest path between tree nodes | Snowflake Interview Question