> For example, I've seen people write code which relies heavily on design patterns but then that same code uses an O(n^2) nested loop to find items that are common between two arrays. There is a simple 'pattern' you can use to store the items of the first array in a Set or HashMap and then finding common items is O(n) because Set and HashMap lookups are O(1)... Very useful pattern but I don't believe it has a name. I use it literally ALL the time. The idea of storing intermediate state in some kind of HashMap is a game-changer IMO but there's no name for that pattern of coding.
Isn't this called 'dynamic programming'? It's actually a habit people should pick up when grinding leetcode.
No, dynamic programming is when you split your bigger problem into a smaller one + 1 step to get to your bigger size. Then apply that recursively until you solve the trivial problem at the end and get back the answer for your original problem size.
No, that is plain old recursion. Dynamic programming is recursive programming with a twist. The twist is that identical sub-problems are short-circuited with memoization.
Putting both contents (lists, arrays, whatever you have) into sets, and then calculating the intersection might be more expensive than building the intersected set right away sourcing both non-set contents, I imagine. Though it would probably be easier to read and understand. But that can be solved by naming of functions that process the 2 non-set things.
In the same way that many people would rather read imperfect ESL than LLM text, I would rather you draw stick figures yourself. The fact that this is a product of AI means anything I see in it may be 'hallucinated' or otherwise incorrect.
Ending most responses with something like, "Did that make sense?" or "Should I clarify anything I just talked about?"
Also, I asked some math questions, and the AI started talking about and giving equations. For me, at least, this was impossible to understand. I know part of the point of this is to make it conversational, but I would think having a transcript displayed somewhere would help a lot.
For bonus points you could do this with the voice input. Only show the transcription when it's relevant or if the user asks.
I've found that there is nothing in these books. I've read enough of them that I now have zero curiosity about what they have to say.
What works for me is to choose to suffer. You can replace all those books and all their pages with just those three words. There's no mindhack or some new scientific (or spiritual) method to no longer suffer when working. Just choose to suffer and get good at suffering.
Well, there can be some tips in the books, so I would not discount them. After all, we are reading those books to try to learn better. But yes, I agree, often we just have to suffer our way to greatness when learning :)
Isn't this called 'dynamic programming'? It's actually a habit people should pick up when grinding leetcode.