Domanda di colloquio di Snap

write a function to return the kth largest element in a binary search tree

Risposta di colloquio

Anonimo

22 ago 2017

Perform inverted in-order traversal (mark right child, then current node, then left child recursively) and mark k nodes. Last node marked is kth largest element