rewrite leetcode inorder postorder build binary tree & context switch & philosophers dining problem