Live data from Hacker News

Many hard LeetCode problems are easy constraint problems

buttondown.com

411–420 of 551 posts

Re: Many hard LeetCode problems are easy constraint problems

#411
post #240

Earlier quoted context omitted.

It's always these low pay jobs that have the sloppiest interview experiences

In at least parts of Europe, 70k-100k is pretty good for a mid/senior developer.

It’s the market rate in my city in Germany (not Berlin not Munich). I pivoted from non CS academia and entered software at 73k

Re: Many hard LeetCode problems are easy constraint problems

#412

Any problem can be solved by a sufficient number of nested for loops. (if you have enough time)

One level of nested for loop for each type of coin. (Run them until i*coin is larger than the input)

Populate a 2d lookup array. $7,50 becomes arr[750] = [7,1,0,0,0,0] which represents [7x100,1x50,0x25,0x10,0x5,0x1]

With each loop check if the array entry exists, if so check if that number of coins is larger. [7,1,0... is better than [7,0,2...] because 8 is a better solution than 9!

Re: Many hard LeetCode problems are easy constraint problems

#413
post #174

Earlier quoted context omitted.

Wait, what.. you did this as a take home for a position? Damn that looks excessive.

Yes. I put a ton of work into it. I had about 60 pages worth of notes. On inverse kinematics, FABRIK, cyclic algorithms used in robotics, A*/RRT for real-world scenarios etc. I was super prepared. Talked to the CEO for about two hours. Took notes on all videos I can find of team members on youtube and their company. Luckily the hiring manager called me back and levelled with me, nobody kept him in the loop and he fel…

> Nerves took over, mind blanked.

This never happened to me in a job interview before I turned 40. But once I knew I was too old to look the part, and therefore and had to knock it out of the park, mind blank came roaring in. I have so much empathy now for anyone it ever happened to when I was giving the a job interview. Performing under that kind of pressure has nothing to do with actual ability to do the job.

Re: Many hard LeetCode problems are easy constraint problems

#414
post #171

Earlier quoted context omitted.

Many interviews now involve automated exercises on websites that track your activity (don't think about triggering a focus change event on your browser, it gets reported). Also, the reviewer gets an AI report telling it whether you copied the solution somewhere (expressed as a % probability). You have few minutes and you're on your own. If you pass that abomination, maybe, you have in person ones. It's ridiculous wha…

"don't think about triggering a focus change event on your browser, it gets reported)." So .. my approach would be to just open dev tools and deactivate that event. Show of practical skill or cheating?

Switching to devtools also triggers a focus change and is detectable by other means (such as repeatedly invoking a debugger statement).

Re: Many hard LeetCode problems are easy constraint problems

#416

Earlier quoted context omitted.

It’s not about memorizing individual problems per se, but rather recognizing overall patterns and turning the process into a gameable endeavor. This can give candidates an edge, but it doesn’t necessarily demonstrate higher-level ability beyond surface familiarity with common patterns and the expectations around them. I’d understand the value if the job actually involved work similar to what's reflected in leetCode s…

>a candidate’s willingness to invest time and effort I guess it's a matter of opinion but my point is, this is probably the right metric. Arguably, the kind of people who shut up and play along with these stupid games because that's where the money is make better team players in large for-profit organizations than those who take a principled stance against ever touching Leetcode because their efforts wouldn't contrib…

Then what if the test was how well you play chess? That takes time to study to become good. But would it be a good metric for hiring programmers?

Re: Many hard LeetCode problems are easy constraint problems

#417
post #346

Earlier quoted context omitted.

To play the devils advocate, being able to memorize patterns and recognize which patterns apply to a given problem is extremely valuable. Tons of software dev is knowing the subset of algorithms, data structures, and architecture that apply to a similar problem and being able to adapt it.

It's funny you mention that. That's literally what CS teaches you too. Which is what "leetcode" questions are: fundamental CS problems that you'd learn about in a computer science curriculum. It's called "reducing" one problem to another. We had an entire semester's mandatory class spend a lot of time on reducing problems. Like figuring out how you can solve a new type of question/problem with an algorithm or two tha…

I did quite a bit of competitive programming in school, and pretty much all the world-class competitive problems are reduced to well-known algorithms. It's quite hard to come up with something new (not proven to be unsolvable for its constraints). I believe problem setters just try to disguise a known algorithm as much as possible.

Then comes the ability/memorization to actually code it, e.g. if I knew it needs coding red-black tree I wouldn't even start.

Re: Many hard LeetCode problems are easy constraint problems

#418
post #171

Earlier quoted context omitted.

"don't think about triggering a focus change event on your browser, it gets reported)." So .. my approach would be to just open dev tools and deactivate that event. Show of practical skill or cheating?

Switching to devtools also triggers a focus change and is detectable by other means (such as repeatedly invoking a debugger statement).

One can type in devtools withouth having the focus on dev tools, but indeed, to track down the event, one has to loose focus for a while. But after you find out what line of js is needed, then you can just inject that without dev tools with greasemonkey for instance.

But probably a general solution exists ... and there are actually extensions that will do that in general.

Re: Many hard LeetCode problems are easy constraint problems

#419
As an interviewer, I gave one pretty simple task (people solved it in as little as 8 minutes), wasn't using any real CS, even though I'm good at it.

The reason was that aboint 70% of candidates couldn't write a simple loop -- to filter those out. The actual solution didn't matter much, I gave a binary decision. The actual conversation matters more.

Re: Many hard LeetCode problems are easy constraint problems

#420

Earlier quoted context omitted.

At least personally, I've been very underwhelmed by their performance when I've tried using them. Usually past a few dozen variables or so is when I start hitting unacceptable exponential runtimes, especially for problem instances that are unsatisfiable or barely-satisfiable. Maybe their optimizations are well-suited for knapsack problems and other classic OR stuff, but if your problem doesn't fit the mold, then it's…

I'm surprised to hear this. Modern SAT solvers can easily handle many problems with hundreds of thousands of variables and clauses. Of course, there are adversarial problems where CDCL solvers fail, but I would be fascinated if you can find industrial (e.g. human written for a specific purpose) formulas with "dozens of variables" that a solver can't solve fairly quickly.

One thing that I spent a particularly long time trying to get working was learning near-minimum-size exact languages from positive and negative samples. DFAMiner [0] has a relatively concise formulation for this in terms of variables and clauses, though I have no way to know if some other reformulation would be better suited for SAT solvers (it uses CaDiCaL by default).

It usually starts taking a few seconds around the ~150-variable mark, and hits the absolute limit of practicality by 350–800 variables; the number of clauses is only an order of magnitude higher. Perhaps something about the many dependencies in a DFA graph puts this problem near the worst case.

The annoying thing is, there do seem to be heuristics people have written for this stuff (e.g., in FlexFringe [1]), but they're all geared toward probabilistic automata for anomaly detection and similar fuzzy ML stuff, and I could never figure out how to get them to work for ordinary automata.

In any case, I eventually figured out that I could get a rough lower bound on the minimum solution size, by constructing a graph of indistinguishable strings, generating a bunch of random maximal independent sets, and taking the best of those. That gave me an easy way to filter out the totally hopeless instances, which turned out to be most of them.

[0] https://github.com/liyong31/DFAMiner

[1] https://github.com/tudelft-cda-lab/FlexFringe

Post reply on HN