In this part, the goal was to calculate a score based on the visibility of elements in the grid. The score is determined by the number of visible elements and their respective heights.
To tackle this problem, I followed these steps:
1. Reuse Previous Logic: I reused the visibility checking logic from Part 1 to maintain consistency.
2. Score Calculation: I modified the visibility checking logic to calculate a score based on the heights of the visible elements.
3. Output: Finally, I printed the total score based on the visibility of elements.
This approach builds on the previous logic while adding the complexity of scoring.