How to ensure that ans variable we are computing in this coding implementation of finding the shortest cycle is coming from the actual correct cycle (ie start of bfs is part of the cycle)
Doubt in the coding implementation
@hv439606 hey ans is overall answer,we have to take all cases ,so we start bfs from each node as every node will contain in one of cycle or not or more than one so to cover that case we have started bfs from all nodes and taken ans as max.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.