You are not logged in. Please login at to post your questions!


problem in detecting cycles in directed graph

I have recently coded to detect cycles in directed graph this is link to my solution. My solution is working fine but I am getting TLE in one test case. Can any one please figure out what is bug in my code.

asked 08 Apr '17, 09:19

arpit728's gravatar image

accept rate: 10%

Can you share the problem link?

(08 Apr '17, 13:21) only44★

The problem is: return 0 if directed graph has a cycle and 1 otherwise.

(08 Apr '17, 13:53) arpit7281★

What are the constraints? Also, as @arpit728 pointed out, it's hard to help you without the problem. We can't tell if something you do in the code can be removed to decrease the runtime or if it's essential to solving the problem.

(09 Apr '17, 17:05) inarito4★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 08 Apr '17, 09:19

question was seen: 768 times

last updated: 09 Apr '17, 17:07