The second one tho...
Pretty complicated. I was able to solve every part of the problem besides the hardest part which is something that is often in a lot of leetcode problems. This component is the idea of a result array to not have duplicates. This means that the way to solve the leetcode has to be done in a special way where it inherently doesn't allow for duplicates.
I should draw a little more. Decision trees help solve A LOT of these medium problems. Also, neetcode is the GOAT. He's great. he should work at amazon and google at the same time. he can handle it.
Here was the drawing I did...
The second one in hindsight is super hard however if its the first time seeing a problem like that. I think an interviewer would appreciate my approach.
One weird thing did happen while I was coding. My list/array skills were failing me. the code was producing a list that was not even close to the thing I wanted. I couldn't find the bug, I hope I run into the issue again to fix it.
P.S. when passing down a variable in python. REMEMBER THAT ITS PASSED BY REFERENCE. SO BECAREFUL WHEN THE SAME VARIABLE IS USED IN MULTIPLE CALLS. USE .copy() method if you have to.
No comments:
Post a Comment