Alternative implementation for flattening binary tree into singly linked list for new online judge.