← Amazon questions

Find two nodes in BST with sum N with space less than O(n)

Filed under Amazon

Given the root of a Binary Search Tree and an integer N, determine if there exist two nodes in the BST whose sum equals N, using less than O(n) space complexity.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.