Top
Best
New

Posted by mpweiher 9/12/2025

Many hard LeetCode problems are easy constraint problems(buttondown.com)
679 points | 533 commentspage 6
non_aligned 9/12/2025|
I think LeetCode tests two things. First, your willingness to grind to pass an exam, which is actually a good proxy for some qualities you need to thrive in a corporate environment: work is often grungy and you need to push through without getting distracted or discouraged.

Second, it's a covert test for culture fit. Are you young (and thus still OK with grinding for tests)? Are you following industry trends? Are you in tune with the Silicon Valley culture? For the most part, a terrible thing to test, but also something that a lot of "young and dynamic" companies want to select for without saying so publicly. An AI startup doesn't want people who have family life and want to take 6 weeks off in the summer. You can't put that in a job req, but you can come up with a test regime that drives such people away.

It has very little to do with testing the skills you need for the job, because quite frankly, probably fewer than 1% of the SWE workforce is solving theoretical CS problems for a living. Even if that's you, that task is more about knowing where to look for answers or what experiments to try, rather than being able to rattle off some obscure algorithm.

RagnarD 9/13/2025||
Nice post, I wasn't aware that there were so many dedicated constraint solving systems.
meindnoch 9/12/2025||
Any problem can be solved by a sufficient number of nested for loops.

(if you have enough time)

6510 9/13/2025||
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!

scotty79 9/12/2025||
And a stack.
theendisney 9/13/2025||

   coins = [100,50,25,10,5,1]
   change = 1234;
   result = [0,0,0,0,0,0];
   for(i=0:i<coins.length;i++){
     while(change>coins[i]){
       result[i]++;
       change-=coins[i];
     }
   }
   //[12,0,1,1,4]
Coudnt help myself sorry
efortis 9/13/2025|
me neither

  function coin_change(change) {
    const coins = [25, 10, 5, 1]
    for (const coin of coins) {
      const n = change / coin | 0
      change -= n * coin
      console.log(coin, n)
    }
  }

  coin_change(25+10+5+1)
theendisney 9/20/2025||
Or....

  [100,500,25,10,5,1].map(coin=>{
     n = change / coin | 0
     change %= coin;
     return n 
    })
Coding on a Phone is hell
6510 9/24/2025||

    change = 12345;
    console.log(
     [100,500,25,10,5,1].map(
       coin=>[change/coin|0,change%=coin][0]
     )
    )
wolvesechoes 9/13/2025||
Whoever agrees to do LC problems during interview has zero dignity.
wvlia5 9/13/2025||
Gröbner basis is an interesting way to solve the 1st problem.
Herring 9/12/2025||
Reminder that the research says the interview process should match the day to day expectations as closely as possible, even to a trial day/week/month. All these brain teasers are low on signal, not to mention bad for women and minorities.
garrettgarcia 9/12/2025||
"Follow-up question since you solved that so quickly: implement a constraint solver."
gnatman 9/13/2025||
“Many hard problems are, to me, quite easy”
techlatest_net 9/12/2025|
[dead]
More comments...