Find Words Containing Character - Leetcode 2942 - Solve with Sam in Python

preview_player
Показать описание
Classic string question, important to have the fundamentals down pat! Follow along as I attempt today's leetcode question live and uncut on a gdoc! I explain my thought process and how I would communicate to a tech interviewer.

00:00 - Intro
01:15 - Discuss approaches
03:42 - Start solve
5:04 - Test on leetcode

_Note:_ I had someone ask me about filter() vs list comprehension, and I think both are valid approaches! I tend towards list comprehension since there is less function call overhead. I ran a quick script doing some x%7==0 filtering on 100M entries, and we see a speedup of ~69%

list/filter/lambda Took 7.09 sec
list comprehension Took 4.20 sec
Рекомендации по теме