No the complexity of the first solution is O(52n). There are only 26 lowercase and 26 uppercase characters hence the search in the jewels list will always be in constant time
2024-09-17 18:41:56
16
neilkulkarni1 :
You can just say jewels = set(jewels), you don’t need the extra list comprehension
2024-09-18 01:13:55
9
SmellyDigger :
i watch these videos with no interest of going for a coding interview....or even coding at all
2024-10-10 14:42:08
3
Greg Hogg :
Master data structures and algorithms for FREE at algomap.io :)
2024-09-17 16:24:58
1
Sherif :
You can get it in O(n) buy using a frequency array
2024-09-18 13:33:26
0
kiwifruit58_ :
This is the issue with python, you make this set, but how do you think thats made? It would take O(n) to create a set from a list length n
2024-11-29 01:12:09
0
Eoin Dudley :
What if n was 1 and m was 1, then 1×1=1 and 1+1=2, making the first one faster
2024-12-11 21:39:25
0
To see more videos from user @greghogg5, please go to the Tikwm
homepage.