If not, how can you claim you have solved the problem?
Many hard LeetCode problems are easy constraint problems
321–330 of 551 posts
Re: Many hard LeetCode problems are easy constraint problems
#322They aren't testing if you can write a solver. They are testing if you can use bricks that solvers are built out of because other software when it gets interesting is built out of the same stuff.
Re: Many hard LeetCode problems are easy constraint problems
#323I've never heard of a "dynamic programming algorithm". Read wikipedia and it seems to mean....use a recursive function? The coin problem is an easy recursive problem (I just wrote the code for it to make sure my old brain can still do it).
> Read wikipedia and it seems to mean....use a recursive function? Yes, that's one (common) approach to dynamic programming. The recursive function call are memoized so that previous calculations are remembered for future function calls. Overlapping subproblems become trivial if you can reuse previously computed values. The recursion with memoization is top-down dynamic programming.
Re: Many hard LeetCode problems are easy constraint problems
#324Earlier quoted context omitted.
It's the same exact thing - if some company makes you jump through hoops to get hired that you find distasteful just don't apply to company.
No. Certain things just harm basic human dignity and should be outlawed. Judgement comes from our peers, not from machines.
Re: Many hard LeetCode problems are easy constraint problems
#325Earlier quoted context omitted.
A surprise live test is absolutely the wrong approach for validating whether someone's done the work. IMO the correct approach is to go through the existing code with the applicant and have them explain how it works. Someone who used AI to build it (or in the past had someone else build it for them) wouldn't be able to do a deep dive into the code.
We did go into the assignment after I gently bowed out of the goofy live test. The CTO seemed uninterested & unfamiliar with it after returning from a 3 week vacation during the whole process. I waited. Was happy to run him through it all. Talked about how to extend this to a real-world scenario and all that, which I did fantastically well at.
Re: Many hard LeetCode problems are easy constraint problems
#326Terrible question for an interview, and further highlights how our interviews are broken. Greedy algorithms tell you nearly nothing about the candidate's ability to code. What are you going to see? A single loop, some comparison and an equality. Nearly every single solution that can be solved with a greedy algorithm is largely a math problem disguised as programming. The entire question hinges on the candidate findin…
My best interview consisted of: -what projects have you done -what tech you worked with and some questions about decisions -debugging an issue they encountered before -talking about interests and cultural fit Instant green flag for me. Too bad that after receiving my offer covid happened and they had a hiring freeze.
You can try to sus out smooth talking faker or just tell them to write a thing and then talk only after they demonstrate basic comprehension.
Re: Many hard LeetCode problems are easy constraint problems
#327Great insight. But this is sadly not applicable to interviews. > It's easy to do in O(n^2) time, or if you are clever, you can do it in O(n). Or you could be not clever at all and just write it as a constraint problem This nails it. The point of these problems is to test your cleverness. That's it. Presenting a not-clever solution of using constraint solvers shows that you have experience and your breadth of knowledg…
> The point of these problems is to test your cleverness. Last round I did at Meta it was clearly to test that you grinded their specific set of problems, over and over again, until you could reproduce them without thinking. It's clear because the interviewers are always a bit surprised when you answer with whatever is not the text-book approach on both leetcode and on the interview guide they studied. Cleverness is…
Re: Many hard LeetCode problems are easy constraint problems
#328Re: Many hard LeetCode problems are easy constraint problems
#329Any problem can be solved by a sufficient number of nested for loops. (if you have enough time)
Re: Many hard LeetCode problems are easy constraint problems
#330I implemented the simple greedy algorithm and immediately fell into the trap of the question: the greedy algorithm only works for "well-behaved" denominations. If the coin values were [10, 9, 1], then making 37 cents would take 10 coins in the greedy algorithm but only 4 coins optimally (10+9+9+9). That's a bad algorithm, then, not a greedy algorithm. Wouldn't a properly-implemented greedy algorithm use as many coins…
By the way, ChatGPT was able to solve this problem and give the correct solution.