For each intermediate vertex k, check if path i→k→j is shorter than current i→j:
dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
Time: O(V³) | Space: O(V²)