Pergunta de entrevista da empresa Bloomberg

Given a binary tree(not necessarily complete), where each node also has a right pointer, how do you set the right point of each node to the node on its right, and the rightmost node on each level has its pointer set to null.