recursive solution for "population next right pointers in each node"