PROBLEMS|MOD 11|MEDIUM

Two Sum IV - Input is a BST

Object-Oriented Programming (OOP)

Given an array of integers `nums` and an integer `target`, return indices of the two numbers such that they add up to `target`.

// EXAMPLES

Example 1:
Input: Input: [2, 7, 11, 15], 9
Output: [0, 1]
Explanation: Result for example 1 of Two Sum IV - Input is a BST.
Example 2:
Input: Input: [3, 2, 4], 6
Output: [1, 2]
Explanation: Result for example 2 of Two Sum IV - Input is a BST.

// CONSTRAINTS

  • -10^9 <= n <= 10^9
  • Time Complexity target: O(N) or O(N log N)
  • Space Complexity target: O(1) or O(N)
  • Evaluated against 600 test cases.
solution.py