Standard Chartered OA 2025 | Number of Ways to Reorder Array to Get Same BST
standard-chartered · Question · Posted Jun 2026
Problem Statement Given an integer array nums consisting of distinct values, construct a Binary Search Tree (BST) by inserting the elements from left to right in the order they appear. Return the number of different permutations of nums that would generate the same BST when inserted into an initially empty BST. Since the answer can be very large, return it modulo: 10^9 + 7 Note: Exclude the original ordering itself from the count. Example 1 Input nums = [2,1,3] BST ...
The full answer & interview discussion are available to premium members.
Log in Create a free account