Sunset Hills

Visualize and solve the classic Sunset Hills coding challenge

The Challenge

Given an array of building heights arranged from west to east, determine which buildings can see the sunset to the west. The sun sets in the west (the left side of the array). A building can see the sunset if all buildings to its left (west) are strictly shorter than it.

How It Works

  • Drag building bars up or down to adjust heights in real-time
  • Use controls and presets to explore different scenarios
  • See instant visualization of which buildings have a sunset view
  • Learn the O(n) algorithm with detailed code explanations in 4 languages

Built With Modern Web Technologies

Bootstrap 5

v5.3.8 - Responsive UI framework

Chart.js

v4.5.0 - Interactive data visualization

ES6+ JavaScript

Modular, modern code

Prism.js

v1.30.0 - Syntax highlighting

Yarn 4

v4.10.3 - Package manager

Parcel

v2.16.0 - Zero-config bundler

Font Awesome

v7.1.0 - Icon library

WCAG 2.1 AA

Accessible design

Development Tools: ESLint 9.17 • Prettier 3.4 • Git

Algorithm: O(n) Time Complexity • O(1) Space Complexity