Visible Towers

Problem Overview

  • For each tower in a sequence, count how many towers are visible to its left and right; a tower is visible if all towers between are strictly shorter than it.
  • Input: int[] height (tower heights); Output: int[] where each value is the visible count for that tower.
  • Real-world context: skyline visibility among buildings in Hackerland.
  • Asked in Salesforce interviews; a common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: