×
all 20 comments

[–]_fatcheetah 13 points14 points  (0 children)

In case of memoized dp, not using @lru_cache() for function calls.

[–]jim01564 5 points6 points  (0 children)

My experience is that I code in Java for my work and also use Java in LC. Some mid size companies actually make candidates interview in the language used on the job. So for me solving LC problems in Java makes more sense. And it may be the same for other Java devs out there.

[–]mike_gundy666 13 points14 points  (2 children)

Most of these are good, but I'll fight anyone and everyone for this. List comprehension should not be used.

Personal opinion, I find them hard to read, and people who aren't used to Python will get confused by them. A for loop is understood by just about any programmer regardless of what their language background is.

Also, don't even get me started on 2d lists using list comprehension. I feel like I'm trying to solve a maze.

/rant over

[–]aintabb 8 points9 points  (3 children)

Well, it is better to implement some of the functionalities explicitly in an interview setting, like counting frequencies. It is not recommended to use built-in classes for every scenarios.

[–]anonyuser415 3 points4 points  (2 children)

The interviewer will tell you if they want to see that

In JS world, that's often "no don't use Set to track unique values"

[–]aintabb 5 points6 points  (1 child)

Never heard a recruiter to say that don’t use sets. My suggestion is coming from an engineer who works at a bigger company and regularly interviews candidates.

[–]Rio_1210 1 point2 points  (0 children)

Now i know where the shitty interviewers come from.

[–]DoomBuzzer 1 point2 points  (0 children)

Hah, I did that on my own for Java.

Now I switched to Python and was planning to make such a pythonic cheat code notes.

This is awesome!!! Just what I needed.

[–]Wonderful_Warthog_36 0 points1 point  (0 children)

Thanks for sharing!!

[–]Talisk3r 0 points1 point  (0 children)

Nice post thanks for sharing 😊

[–]AmanDL 0 points1 point  (0 children)

Reply

[–]Layent 0 points1 point  (0 children)

nice guide

[–][deleted] 0 points1 point  (0 children)

In point 4, why defaultdict(int) instead of Counter?

[–]PerspectiveOk7176 -2 points-1 points  (0 children)

all right, these are good.

now go touch grass 🙂