Skip to content

Instantly share code, notes, and snippets.

View kumar-muthu's full-sized avatar

Muthukumar Rajendran kumar-muthu

View GitHub Profile
@kean
kean / CtCI-6h-problem-4.9.markdown
Last active February 24, 2023 14:53
CtCI 6h Edition, Problem 4.9: BST Sequences.

Problem 4.9. BST Sequences: A binary search tree was created by traversing through an array from left to right and inserting each element. Given a binary search tree with distinct elements, print all possible arrays that could have led to this tree.

Solution.

Let's start with an example.

    4
   / \
  2   5