Day 12: Hill Climbing Algorithm
Day 12 involves finding the shortest path through a grid of varying elevations.
Problem Overview
You need to navigate a heightmap representing a hilly area, finding the shortest path from a starting position to an ending position. The key constraints are:
- You can only move to adjacent squares that are at most one unit higher than your current position
- You can move to squares of any lower elevation
- For Part 1, you need to find the shortest path from a specific starting point to a specific ending point
- For Part 2, you need to find the shortest path from any lowest-elevation square to the ending point
This problem tests your ability to implement pathfinding algorithms, specifically breadth-first search (BFS), on a 2D grid with special movement constraints.
Navigation
- Problem Description: Detailed description of the day's challenge
- Solution Explanation: Walkthrough of the approach used
- Code: The complete implementation with comments