PSP

Oct 27, 2025 | Competitive Programming Essentials

#Problem Difficulty Status Primary Topics Solution Link Metacognition/Process Takeaways Analysis
Rotting Oranges Medium Complete BFS, Graph, 2D-Grid Traversal [Solution Link] Realized it must be BFS to find the minimum time (shortest path from multiple sources). Tricky part was initializing the queue with all rotten oranges at time t=0. BFS on a grid is the standard pattern for shortest time/distance problems. Need a counter for fresh oranges to check the final condition. Must remember the final check: if (fresh_count > 0) return -1. Could have been cleaner using a single integer for ‘minutes’ instead of tracking layers explicitly.