Mo7ammadAbuSafat / Foothill-Trainee

for code review
0 stars 0 forks source link

Time Limit Exceeded due to List.Remove #1

Closed MazenAmria closed 1 year ago

MazenAmria commented 2 years ago

Apparently, you've replaced the set with LinkedList which increased the Remove time to O(n) in the worst case scenario.

https://github.com/Mo7ammadAbuSafat/foothill-trainee/blob/637294603ad2be4d2adff339977ff2975bf92cb2/Solve%205%20Any%20LeetCode%20Questions/LRUCache.cs#L33

But I would accept the solution for now. It's optional to get the accepted solution of the problem.

Mo7ammadAbuSafat commented 2 years ago

On Sun, 6 Nov 2022 at 11:22 AM Mazen Amria @.***> wrote:

Apparently, you've replaced the set with LinkedList which increased the Remove time to O(n) in the worst case scenario.

https://github.com/Mo7ammadAbuSafat/foothill-trainee/blob/637294603ad2be4d2adff339977ff2975bf92cb2/Solve%205%20Any%20LeetCode%20Questions/LRUCache.cs#L33

But I would accept the solution for now. It's optional to get the accepted solution of the problem.

— Reply to this email directly, view it on GitHub https://github.com/Mo7ammadAbuSafat/foothill-trainee/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYVF245KDDDJUFEBRE6S4S3WG52GRANCNFSM6AAAAAARYKYQWY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Ok, I will search for it