Cycle detection in graph using DFS

I did this problem but there is some error please help me identify where is the error
Solution Link-https://ide.codingblocks.com/s/384314
Question-https://www.interviewbit.com/problems/cycle-in-undirected-graph/#

You did’t even answer the question and closed the doubt without even solving

Hey @mridulmohanbagri17 as you have reopened your doubt,it’s assigned to me. I got the issue. Solving it.

Your logic seems correct to me? Just try to run for loop from 0 to B.size() rather then 0 to A in line 26. If this doesn’t get accepted do let me know.

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.