Variant of BST Level Order Traversal

Asked at Meta · Coding & Leetcode-style Questions · Difficulty: Medium

Given a binary search tree (BST), implement a variant of level order traversal. The requirement is to reverse the order of nodes in every alternate level. For example, the first level is from left to right, the second level is from right to left, the third level is left to right again, and so on.

Loading the problem…