Hi. I have taken this solution from Tourist’s code. The logic is exactly the same. The only difference is that he has used structure to store the variables, and in this solution, i have used a TreeMap and a LinkedHashMap for storing the values.
Can you please help me identify why i’m getting a TLE?
Solution Link : CodeChef: Practical coding for everyone
Tourist’s Solution : CodeChef: Practical coding for everyone