I did it by contructing BST while keeping track of height. But it exceeded the time limit.
Any way to solve above problem faster.
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
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