Need help in Kickstart Round C 2nd question

Правка en2, от Admiral_General_Aladeen_, 2020-05-19 09:13:01

I have tried to solve this question using topological sort. I am getting correct output for 3 out of the 4 test cases given in the sample test cases on kickstart website. I will be very thankful if someone can help me find the mistake in my code. I have been trying to find any mistake but couldn't

Approach — To get the correct ordering of letters I have made a string out of all columns starting from last row to first row. I am adding a letter of its type only once in a string. Now using all these strings I am building a graph pointing from bottom row to top row. Now I am just applying topological sort to get the ordered string as the answer.

Here is the link to my solution — http://p.ip.fi/IVy2 Here is the link for ideone (you can see that I am getting correct output for 3/4 cases) : https://ideone.com/OXNJcW

Thank you

Теги #googlekickstart, #graphs, #topological_sort

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Admiral_General_Aladeen_ 2020-05-19 09:13:01 480
en1 Английский Admiral_General_Aladeen_ 2020-05-19 09:03:45 511 Initial revision (published)