why the output is
1->2
2->2
3->2
4->3
5->3
6->3
shouldnt it be
1->1
2->1
3->1
4->2
5->2
6->2
as col value is 1
At timestamp 7:40
That is because the code is wrong.
The loop should not be from n to 1, but from n - 1 to 0. The dfs from order[n] (a garbage value) is wasted, hence color 1 is wasted.