CodingReported in a candidate post, Aug 2025
Count connections between consecutive levels of 1s in a matrix
Filed under JPMorgan Chase
The question
Given an m by n matrix of 1s and 0s, count how many connections can be made from each level to the next feasible level. Each 1 connects to every 1 on the next level, and if a level has no 1s, use the next level that does. Example [[1,0,0,1],[1,1,0,1],[0,0,0,0],[1,0,0,0]] gives 9.
No write-up yet. Related questions below have one.
Related JPMorgan Chase questions
Collected from public candidate posts and coding forums. Updated Nov 2026.