A directed graph is given and you have to output one of the odd cycles

Revision en2, by kittyK, 2020-07-27 13:10:52

Given a graph with n nodes and m edges . n ≤ 100,000 and m ≤ 1,000,000 . We have to find any odd cycle.

Question Link

How to solve this problem ? I tried in naive way. I just stored the nodes when I get any cycle of odd length . But it will obviously TLE.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English kittyK 2020-07-27 13:10:52 18
en1 English kittyK 2020-07-27 13:10:07 445 Initial revision (published)