ijk with binary tree solution