memo: dict[int, int] = {0: 0, 1: 1} # *our base cases*
returns the following error:
TypeError: 'type' object is not subscriptable
I guess you should use Dict
, e.g.:
from typing import Dict
memo: Dict[int, int] = {0: 0, 1: 1}
In your case, you were using dict
which is of type type
>>> type(dict)
<class 'type'>
>>> type(Dict)
<class 'typing._GenericAlias'>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With