ENGLISH : Codechef Jan 2020 Long Challenge video solution

Hey folks , here you can find the video editorial of


Thank you guys for watching and keep coding.


It was really helpful , thank you.

Is there a way in which we can know that where was my code lacking?
I tried a different approach but it was failing 2 or 3 test cases. So can I know where does my code fail?

I feel there is a need to reveal testcases(atleast after contest) as it happens in codeforces. What say @admin It will help one who came closer to correct solution know where he lagged.

i feel the same , after contest revealing test case should not be a problem.

1 Like

can you tell me where to study TRIE ?


unfortunately codechef does not reveal test cases , don’t know the reason but they don’t.
you have to go through the code and check for mistakes.

yeah i completely agree , it would help a lot when you are stuck at a problem and couldn’t figure out what test cases are failing.

well thank you .

you’re always welcome…

If we all give this as a suggestion/feedback, then do you think codechef will consider this request?
Chances are very less, but should we give it a try? What say @admin?

Wow. Just Wow. God Level Logic.

Someone: "Hey my code works for palindromes! It fails for non-palindromes. What should i do?

@waqar_ahmad224 : “Just convert non-palindromes to palindromes. EUREKA!!”

Really this is a great logic!! Well done @waqar_ahmad224 :wink::wink:

well , this is god level appreciation i have received so far.
Thanks man.

1 Like

Thanks very much for the useful tutorial :). It took me days of thinking but I couldn’t come up with such a solution.

My Intuition is somewhat the same as yours. But I solved a different way. The difference is that I didn’t create a new string and not used Trie, instead, I made tuple of every pair of prefix and suffix of each word and hashed with pair of length and index in a map(dictionary). Then, iterated that map with decreasing order length and for each key, added length it carries to beauty and marked that index processed.
Well, due to lacking preferred data structure my solution is a bit less efficient than yours but worked well in Long Challange.

Bytheway, yours Editorial is really great. Now I have another approach to do the same problem. Keep it up bro.:blush:

Thank you very much. Really awesome explanation.

you’re welcome.

You’re welcome man.