---
title: "Discussion on \"Two Sum IV - Input is a BST\" | Hashnode"
description: "Discussion on \"Two Sum IV - Input is a BST\". Problem\nGiven the root of a binary search tree and an integer k, return true if there exist two elements in the BST such that their sum is equal to k, or false otherwise.  (link)\nExample 1:\n\nInput: root = [5,3,6,2,4,null,7], k = 9\nOutput: true\n\nExamp..."
url: "https://hashnode.com/posts/two-sum-iv-input-is-a-bst/6885c168e1dcf9bf52441c4f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Two Sum IV - Input is a BST](https://chetan77.hashnode.dev/two-sum-iv-input-is-a-bst?utm_source=hashnode&utm_medium=feed)

Problem Given the root of a binary search tree and an integer k, return true if there exist two elements in the BST such that their sum is equal to k, or false otherwise. (link) Example 1: Input: root = \[5,3,6,2,4,null,7\], k = 9 Output: true Examp...

Jul 27, 2025 · 2 min read · chetan77.hashnode.dev  
Read the article

-   [#two-sum-iv](https://hashnode.com/tag/two-sum-iv)
-   [#bst-iterator](https://hashnode.com/tag/bst-iterator)
-   [#two-sum](https://hashnode.com/tag/two-sum)
-   [#binary-search-tree](https://hashnode.com/tag/binary-search-tree)
-   [#binarytrees](https://hashnode.com/tag/binarytrees)
-   [#iterator](https://hashnode.com/tag/iterator)

## Written by

[Chetan Datta](https://hashnode.com/@chetan77)

@chetan77 · Hyderabad, India

  
[View profile](https://hashnode.com/@chetan77)

Software Engineer

I share my learnings here. Thanks for reading.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
