Cambium Networks | Online Assessment | Max Height of BST
  1. Maximum height of the BST created by inserting the elements of given array arr[], in the sequential order.
    • I did it by contructing BST while keeping track of height. But it exceeded the time limit.

    • Any way to solve above problem faster.

  2. Given
    • An array arr[] of integers, where each element has a value of either 1 or 0.

    • Let an operation O be defined on array arr[], which when performed on arr[], returns new array say arr2[] of same size, where

      • First and last elements of arr2[] will be 0.
      • for remaining elements of arr2[], arr2[i] = 1 if arr[i - 1] == arr[i+1].
    • what will be the output array after performing operation O on given array** arr[]**, X times.

    • Any way to solve above problem under 1sec runtime ?
      array length <= 8
      X <= 10^9

Comments (1)