Getting TLE despite of O(n) time complexity
source link: http://codeforces.com/blog/entry/96951
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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..
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK