There seem to be many misunderstandings about Leetcode (or algorithm problems), such as the need to memorize all Leetcode problems before going for an interview, or that algorithm problems are intelligence tests (so problem-solving ability cannot be improved through practice). Many people criticize algorithm interviews as being disconnected from work, but we have no control over how each company interviews candidates, and discussing this has no help in passing the interview. Here I want to share…
Python line profiler is a very convenient package that allows you to easily see the time taken for each line of code to execute. However, a fatal flaw is that it does not support profiling in multiprocessing, and there has been an open issue on Github since 2016. Here, I provide a hacky workaround for using line profiler in multiprocessing.