aman_naughty's blog

By aman_naughty, history, 4 weeks ago, In English,

I want help please don't down-vote.

I want to print the cycle in an undirected graph. I know how to detect cycle in an undirected graph but can't determine how to find the vertices involved in the cycle. Here is the code to find cycle.

code

Can someone please tell me how to modify this so that I can get the vertices in the cycle as well.

I have seen geeksforgeeks article on printing all cycles but I can't understand it. Is there some simpler approach ?

Read more »

 
 
 
 
  • Vote: I like it  
  • +3
  • Vote: I do not like it  

By aman_naughty, history, 5 weeks ago, In English,

Is this code to detect cycle in an undirected graph correct. I have run it on a few test cases and it seems good . Can someone from the community verify it.

code:

code

Read more »

 
 
 
 
  • Vote: I like it  
  • -35
  • Vote: I do not like it  

By aman_naughty, history, 5 weeks ago, In English,

Problem Link : link

code link : code

In the bfs part I am extracting nodes at a given level and then in help function I am greedily sorting the CT and TT by CT time in acsending order as we want the developer to finish the module code asap so that the tester can attend to it. Also I believe that it doesn't matter if we process level 1 first and then subsequent levels as I am adding the time of each level to my answer. Why is this code giving WA. Any help is appreciated.

P.S- No one was able to solve this problem in the contest and thus it seems an interesting problem.

Read more »

 
 
 
 
  • Vote: I like it  
  • -16
  • Vote: I do not like it  

By aman_naughty, history, 5 weeks ago, In English,

Problem : problem

Code :

code

. I want to know the time complexity of my algorithm. Although it runs within 16 ms on leetcode but is it really O(n) time and O(1) space??

Read more »

 
 
 
 
  • Vote: I like it  
  • -3
  • Vote: I do not like it  

By aman_naughty, history, 5 weeks ago, In English,

Why does this solution fail at test 21 ?? code : 51444038. and this solution gives AC though code : 51444907 . Aren't the two doing the same thing??

Read more »

 
 
 
 

By aman_naughty, history, 6 weeks ago, In English,

Problem : problem

My code : code

Why is my DSU solution failing on test 14. Am I applying wrong logic Please help

Read more »

 
 
 
 
  • Vote: I like it  
  • -7
  • Vote: I do not like it  

By aman_naughty, history, 2 months ago, In English,

I want to know what is the minimum contribution one can have on codeforces. I am currently at -68 , is there anyone with less contribution than this? Also does having negative contribution affect the accessibility of features on codeforces?? Can the community help me beat r_pi in negative contribution. Come on it's time for a change. bring those downvotes assholes xD

Read more »

 
 
 
 
  • Vote: I like it  
  • -16
  • Vote: I do not like it  

By aman_naughty, history, 3 months ago, In English,

problem link : LINK

submission link : code

I am adding words to the trie and while adding i also store at each node the lexicographically largest encrypted code encountered till now in it. As the encrypted code is unique for all the strings I maintain a hashmap with key=encrypted string and value = original string Then for any query my answer is simply the number of vowels in the original string found after searching the prefix in trie. Why is my code giving wrong answer. Can someone provide some test cases where this fails??

P.S. why are people downvoting this

Read more »

 
 
 
 
  • Vote: I like it  
  • -18
  • Vote: I do not like it