Mouse 1 can eat k
types of cheese. Mouse 2 can eat all of them. Cheese at index i
can only be eaten by one of the two mice at a time.
That means, if mouse 1 eats rewards1[2]
, mouse 2 cannot eat cheese at index 2.
Since our goal is maximising - mouse 1 should eat the top k rewarding cheeses, and the remaining ones are automatically eaten by mouse 2.
Code
Python3
Big O Analysis
-
Runtime
The runtime complexity here is since we are using functions like
enumerate
,zip
, andsum
. -
Memory
The memory usage is since we create lists with functions like
enumerate
, andzip
. Also,set()
.
— A