Top
Best
New

Posted by mpweiher 1 day ago

Many hard LeetCode problems are easy constraint problems(buttondown.com)
548 points | 459 commentspage 4
wolvesechoes 7 hours ago|
Whoever agrees to do LC problems during interview has zero dignity.
chipsrafferty 18 hours ago||
Would love to know how to actually assess the runtime complexity of constraint solvers like this.
BhavdeepSethi 18 hours ago||
It's insane how many of these new "AI" companies don't let you use AI or even your own IDE for coding interviews. And most questions from such companies are LC type problems so they know any AI tool can one shot it.
henry2023 18 hours ago||
I discourage it but I let them use it and then give them a specific problem that I know your average Claude 4 or GPT 5 will just not get it right.

Actually people perform worse in an interview using AI because they spend time trying to understand what the tool is proposing and then time to figure out why that doesn’t work.

BhavdeepSethi 16 hours ago||
My experience has been quite different. With Cursor/Claude code, I've ended up writing full fledge solutions (running cli/web servers with loggers and unit tests for each functionality). We're talking crawlers, cab booking service like uber, search engines with seed data. All within the hour.
IshKebab 18 hours ago||
Why is that insane? Seems logical to me.
BhavdeepSethi 17 hours ago||
Definitely not insane. Ironic is the correct term. The field is evolving, a lot of these companies talk about replacing outdated practices using AI. Asking software engineers to not use their own tools to solve problems falls under the same bucket.
swiftcoder 22 hours ago||
> Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.

Maybe it's my graphics programmer brain firing on all cylinders, but isn't this just a linear scan, maintaining a list of open rectangles?

mattmcal 22 hours ago||
Yes, you just need to maintain a stack of rectangles ordered from lowest to highest. You only ever have to push and pop the top of the stack, so the runtime is O(n).
RagnarD 12 hours ago||
Nice post, I wasn't aware that there were so many dedicated constraint solving systems.
whatever1 21 hours ago||
I tried a couple of times long time ago to solve them with cp/integer programming.

The interviewers were clueless so after 10 minutes of trying to explain to them I quit and fell back to just writing the freaking algo they were expecting to see.

phendrenad2 20 hours ago||
So LeetCode has fallen into the same trap as ProjectEuler (anyone remember that?)
taylodl 1 day ago||
Use the right tool for the right job!
dataflow 23 hours ago||
My beef with someone using a constraint solver here is that they almost certainly wouldn't be able to guarantee anything about their solution other than that, if it produces an output, it will be correct. They won't be able to guarantee running time, space usage, or (probably for most tools) even a useful progress indicator. The problem isn't merely that they used another tool - the problem is that they abstracted away critical details. Had they provided a handwritten solution from scratch with the same characteristics, it would've exhibited the same problems.

This doesn't mean they can't provide a constraint solver solution, but if they do, they'd better be prepared to address the obvious follow-ups. If they're prepared to give an efficient solution afterward in the time left, then more power to them.

Der_Einzige 23 hours ago|
[flagged]
dataflow 17 hours ago|||
> First of all, Nice ChatGPT response

What the heck are you talking about? I didn't even visit ChatGPT today.

CamperBob2 22 hours ago|||
That's an en-dash, not an em-dash
Der_Einzige 21 hours ago||
"It's not X, It's Y"
graynk 18 hours ago||
I don't think someone with an account from 2012 and 20k karma would be posting LLM-generated comments. It also doesn't read as one. It doesn't even use the "it's not x it's y" formula, it contraposes things against each other. Like I just did.
notemap 21 hours ago|
https://codeforces.com/problemset/problem/1889/D
More comments...