Max Increase to Keep City Skyline
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
A city is laid out as an n x n grid, and grid[r][c] is the height of the building on block (r, c). Looking at the city from the left or right, you see the tallest building in each row; looking from the top or bottom, you see the tallest building in each column. These silhouettes form the city's skylines.
You may raise the height of any buildings by any non-negative amounts, as long as the skyline seen from all four directions stays exactly the same.
Return the **maximum total** amount by which the building heights can be increased.
Examples
Constraints
- `n == grid.length == grid[r].length`
- `2 <= n <= 50`
- `0 <= grid[r][c] <= 100`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.