Practice · 3 of 5
Count the path cells
CHALLENGE
Difficulty: beginner+25 XP
Implement countOnPath(int[][] g): count cells whose value is 1 that lie in **row 0**, in the **last column**, or on the **main diagonal** (cells where row == col). A cell satisfying several conditions still counts once.
Press Submit to check your solution.
Back to lesson: Practice: 2D array reps