Maximize the sum of two array values minus the distance between their indices
Company: Wayfair
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
Overview: Given an array of sightseeing spot values, find the pair of indices i < j that maximizes the sum of their two values minus the distance between them. The problem tests whether you can rearrange a pairwise score so that a quadratic search over all pairs becomes a single linear scan.