Bounding Diagonal Weights

Bounding Diagonal Weights is a Databricks interviews coding interview problem. Given an n x n grid, for each starting cell in the leftmost column, trace a bouncing diagonal that moves up-right, bounces off the top edge, and ends at the rightmost column. This interview question asks to compute the weight (sum of visited cells) for each start.

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: