Sales Force OA

Salesforce · Question · Posted Aug 2023

SalesForce Hackerrank You are given a list of maximum heights for N towers. [1, i, ... n] Your goal is to return the maximum possible sum of the N towers' height.   The constraints are: for a tower i where there is [1...j,i,k...n] it should not be the case where height[j] > height[i] and height[i] < height[k] (AKA no valleys in terms of height) where 0<= j < i < k < n   e.g. [5,10,5,10,5] => [5,10,5,5,5] is a ...

The full answer & interview discussion are available to premium members.

Log in Create a free account