Karim Meets Gollum

After hearing about Bilbo’s Ring that he found in the Misty Mountains, Karim the Hobbit decided to e…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

How wouldn’t get this solution TLE? If the input is like this…
1
1073741824 11
In the above solution, find_all(); function has complexity O((1<<30)*30). Because 2^30 = 1073741824.