Getting TLE despite of O(n) time complexity

Revision en1, by msatanzeel, 2021-11-14 21:34:30

Today there was Google's Kickstart round H and I have a doubt in the question 3 of it, here's that link to the problem , I have solved this using a doubly linked list data structure for efficient replacements and anyone can easily analyze that over all time time complexity is O(n) , here's is the link to my code.Can someone please tell the reason for the TLE over large inputs..

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English msatanzeel 2021-11-14 21:34:30 555 Initial revision (published)