Phase 3 / array-reversal
Phase 1 / dijkstra, optimization
Phase 5 / advanced-dp
Phase 3 / monotone-queue-dp