So, we can actually construct the graph and then go via each vertex.
If for a adjacency vertices we don’t find it in entry, that means that’s it’s the leave and no more level
time Complexity will be O(N^2) though
Terrible. Just thinking through.
So, we can actually construct the graph and then go via each vertex.
If for a adjacency vertices we don’t find it in entry, that means that’s it’s the leave and no more level
time Complexity will be O(N^2) though
Terrible. Just thinking through.
Hi @Gaurav7 ,
Thank you so much for reaching out to us.
There are always multiple situations of a single problem, and each solution is correct, but we always try to have the optimal solution for each problem. Solution with minimum cost is always the best solution and always appreciated.