Given a complete binary tree (array/heap-style, parent = child/2 relation), find the last node in the tree in less than O(n) time.
The interviewer hinted at using the parent = child/2 index relationship to improve an O(n) solution. The candidate did not find the faster approach during the interview.
Implement find_last_node(heap). The input is a one-indexed array whose active nodes occupy a contiguous prefix, followed only by None values. Return the one-indexed position of the last active node, or 0 if the tree is empty.
def find_last_node(heap):