Skip to content
Advertisement

Tag: time-complexity

How to make this greedy function faster?

I am trying to solve a problem and my code fails at one test case where the list is of length 25000. Is there any way I can make this faster. I tried using functools.lru_cache and I still can not run within the time required to complete. This is the problem from the site Given an array of non-negative integers

Advertisement